diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
commit | 9f4dbff6669c8037f3b036bcf580d14f1a4f12a5 (patch) | |
tree | 47df2c12b57214af6c31e47404b005675b8b7ffc /lib/Format/UnwrappedLineParser.h | |
parent | f73d5f23a889b93d89ddef61ac0995df40286bb8 (diff) | |
download | src-9f4dbff6669c8037f3b036bcf580d14f1a4f12a5.tar.gz src-9f4dbff6669c8037f3b036bcf580d14f1a4f12a5.zip |
Vendor import of clang RELEASE_350/final tag r216957 (effectively, 3.5.0 release):vendor/clang/clang-release_350-r216957
Notes
Notes:
svn path=/vendor/clang/dist/; revision=274958
svn path=/vendor/clang/clang-release_350-r216957/; revision=274959; tag=vendor/clang/clang-release_350-r216957
Diffstat (limited to 'lib/Format/UnwrappedLineParser.h')
-rw-r--r-- | lib/Format/UnwrappedLineParser.h | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/Format/UnwrappedLineParser.h b/lib/Format/UnwrappedLineParser.h index f1f4e57a20b3..c9182e9d71d3 100644 --- a/lib/Format/UnwrappedLineParser.h +++ b/lib/Format/UnwrappedLineParser.h @@ -16,9 +16,9 @@ #ifndef LLVM_CLANG_FORMAT_UNWRAPPED_LINE_PARSER_H #define LLVM_CLANG_FORMAT_UNWRAPPED_LINE_PARSER_H +#include "FormatToken.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Format/Format.h" -#include "FormatToken.h" #include <list> namespace clang { @@ -82,9 +82,10 @@ private: void parseStructuralElement(); bool tryToParseBracedList(); bool parseBracedList(bool ContinueOnSemicolons = false); - void parseReturn(); void parseParens(); + void parseSquare(); void parseIfThenElse(); + void parseTryCatch(); void parseForOrWhileLoop(); void parseDoWhile(); void parseLabel(); @@ -98,8 +99,9 @@ private: void parseObjCUntilAtEnd(); void parseObjCInterfaceOrImplementation(); void parseObjCProtocol(); - void tryToParseLambda(); + bool tryToParseLambda(); bool tryToParseLambdaIntroducer(); + void tryToParseJSFunction(); void addUnwrappedLine(); bool eof() const; void nextToken(); @@ -107,12 +109,22 @@ private: void flushComments(bool NewlineBeforeNext); void pushToken(FormatToken *Tok); void calculateBraceTypes(); - void pushPPConditional(); + + // Marks a conditional compilation edge (for example, an '#if', '#ifdef', + // '#else' or merge conflict marker). If 'Unreachable' is true, assumes + // this branch either cannot be taken (for example '#if false'), or should + // not be taken in this round. + void conditionalCompilationCondition(bool Unreachable); + void conditionalCompilationStart(bool Unreachable); + void conditionalCompilationAlternative(); + void conditionalCompilationEnd(); + + bool isOnNewLine(const FormatToken &FormatTok); // FIXME: We are constantly running into bugs where Line.Level is incorrectly // subtracted from beyond 0. Introduce a method to subtract from Line.Level // and use that everywhere in the Parser. - OwningPtr<UnwrappedLine> Line; + std::unique_ptr<UnwrappedLine> Line; // Comments are sorted into unwrapped lines by whether they are in the same // line as the previous token, or not. If not, they belong to the next token. @@ -185,10 +197,11 @@ private: std::stack<int> PPChainBranchIndex; friend class ScopedLineState; + friend class CompoundStatementIndenter; }; struct UnwrappedLineNode { - UnwrappedLineNode() : Tok(NULL) {} + UnwrappedLineNode() : Tok(nullptr) {} UnwrappedLineNode(FormatToken *Tok) : Tok(Tok) {} FormatToken *Tok; |