summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-11-07 17:43:07 +0000
committerDaniel Jasper <djasper@google.com>2013-11-07 17:43:07 +0000
commitbc5cb4e369088a94da2a515b73b6d0d7e0495043 (patch)
tree4edaa1dec71ea69dbf3d43f9cf0bad0b15500e4f /clang/lib/Format
parent66da53e0dacae427272360cb02ddf76772fb5d59 (diff)
downloadbcm5719-llvm-bc5cb4e369088a94da2a515b73b6d0d7e0495043.tar.gz
bcm5719-llvm-bc5cb4e369088a94da2a515b73b6d0d7e0495043.zip
clang-format: Remove old hack that mainly made incorrect tests pass.
As a side-effect, constructors definitions will correctly be recognized and formatted as function declarations. Tests will be added in a follow-up patch actually using the correct recognition. llvm-svn: 194209
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 13d3facb079..f18627ef581 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -32,8 +32,7 @@ public:
AnnotatingParser(const FormatStyle &Style, AnnotatedLine &Line,
IdentifierInfo &Ident_in)
: Style(Style), Line(Line), CurrentToken(Line.First),
- KeywordVirtualFound(false), NameFound(false), AutoFound(false),
- Ident_in(Ident_in) {
+ KeywordVirtualFound(false), AutoFound(false), Ident_in(Ident_in) {
Contexts.push_back(Context(tok::unknown, 1, /*IsExpression=*/false));
}
@@ -367,7 +366,8 @@ private:
case tok::l_paren:
if (!parseParens())
return false;
- if (Line.MustBeDeclaration && NameFound && !Contexts.back().IsExpression)
+ if (Line.MustBeDeclaration && Contexts.size() == 1 &&
+ !Contexts.back().IsExpression)
Line.MightBeFunctionDecl = true;
break;
case tok::l_square:
@@ -632,7 +632,6 @@ private:
if (isStartOfName(Current) && !Line.MightBeFunctionDecl) {
Contexts.back().FirstStartOfName = &Current;
Current.Type = TT_StartOfName;
- NameFound = true;
} else if (Current.is(tok::kw_auto)) {
AutoFound = true;
} else if (Current.is(tok::arrow) && AutoFound &&
@@ -853,7 +852,6 @@ private:
AnnotatedLine &Line;
FormatToken *CurrentToken;
bool KeywordVirtualFound;
- bool NameFound;
bool AutoFound;
IdentifierInfo &Ident_in;
};
OpenPOWER on IntegriCloud