summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/clang/lib/Format/UnwrappedLineParser.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Format/UnwrappedLineParser.h')
-rw-r--r--contrib/llvm/tools/clang/lib/Format/UnwrappedLineParser.h25
1 files changed, 19 insertions, 6 deletions
diff --git a/contrib/llvm/tools/clang/lib/Format/UnwrappedLineParser.h b/contrib/llvm/tools/clang/lib/Format/UnwrappedLineParser.h
index f1f4e57..c9182e9 100644
--- a/contrib/llvm/tools/clang/lib/Format/UnwrappedLineParser.h
+++ b/contrib/llvm/tools/clang/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;
OpenPOWER on IntegriCloud