aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/UnwrappedLineParser.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.h')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.h b/clang/lib/Format/UnwrappedLineParser.h
index 3394bfab8b8e..f043e567eb73 100644
--- a/clang/lib/Format/UnwrappedLineParser.h
+++ b/clang/lib/Format/UnwrappedLineParser.h
@@ -44,11 +44,23 @@ struct UnwrappedLine {
/// The indent level of the \c UnwrappedLine.
unsigned Level;
+ /// The \c PPBranchLevel (adjusted for header guards) if this line is a
+ /// \c InMacroBody line, and 0 otherwise.
+ unsigned PPLevel;
+
/// Whether this \c UnwrappedLine is part of a preprocessor directive.
bool InPPDirective;
+ /// Whether this \c UnwrappedLine is part of a pramga directive.
+ bool InPragmaDirective;
+ /// Whether it is part of a macro body.
+ bool InMacroBody;
bool MustBeDeclaration;
+ /// \c True if this line should be indented by ContinuationIndent in
+ /// addition to the normal indention level.
+ bool IsContinuation = false;
+
/// If this \c UnwrappedLine closes a block in a sequence of lines,
/// \c MatchingOpeningBlockLineIndex stores the index of the corresponding
/// opening line. Otherwise, \c MatchingOpeningBlockLineIndex must be
@@ -111,9 +123,9 @@ private:
void parsePPDirective();
void parsePPDefine();
void parsePPIf(bool IfDef);
- void parsePPElIf();
void parsePPElse();
void parsePPEndIf();
+ void parsePPPragma();
void parsePPUnknown();
void readTokenWithJavaScriptASI();
void parseStructuralElement(bool IsTopLevel = false,
@@ -131,6 +143,7 @@ private:
void parseUnbracedBody(bool CheckEOF = false);
void handleAttributes();
bool handleCppAttributes();
+ bool isBlockBegin(const FormatToken &Tok) const;
FormatToken *parseIfThenElse(IfStmtKind *IfKind, bool KeepBraces = false);
void parseTryCatch();
void parseLoopBody(bool KeepBraces, bool WrapRightBrace);
@@ -140,12 +153,11 @@ private:
void parseCaseLabel();
void parseSwitch();
void parseNamespace();
- void parseModuleImport();
+ bool parseModuleImport();
void parseNew();
void parseAccessSpecifier();
bool parseEnum();
bool parseStructLike();
- void parseConcept();
bool parseRequires();
void parseRequiresClause(FormatToken *RequiresToken);
void parseRequiresExpression(FormatToken *RequiresToken);
@@ -174,6 +186,13 @@ private:
bool tryToParsePropertyAccessor();
void tryToParseJSFunction();
bool tryToParseSimpleAttribute();
+ void parseVerilogHierarchyIdentifier();
+ void parseVerilogSensitivityList();
+ // Returns the number of levels of indentation in addition to the normal 1
+ // level for a block, used for indenting case labels.
+ unsigned parseVerilogHierarchyHeader();
+ void parseVerilogTable();
+ void parseVerilogCaseLabel();
// Used by addUnwrappedLine to denote whether to keep or remove a level
// when resetting the line state.
@@ -197,7 +216,7 @@ private:
//
// NextTok specifies the next token. A null pointer NextTok is supported, and
// signifies either the absence of a next token, or that the next token
- // shouldn't be taken into accunt for the analysis.
+ // shouldn't be taken into account for the analysis.
void distributeComments(const SmallVectorImpl<FormatToken *> &Comments,
const FormatToken *NextTok);
@@ -342,7 +361,8 @@ struct UnwrappedLineNode {
};
inline UnwrappedLine::UnwrappedLine()
- : Level(0), InPPDirective(false), MustBeDeclaration(false),
+ : Level(0), PPLevel(0), InPPDirective(false), InPragmaDirective(false),
+ InMacroBody(false), MustBeDeclaration(false),
MatchingOpeningBlockLineIndex(kInvalidIndex) {}
} // end namespace format