diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-13 08:12:18 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-13 08:12:18 +0000 |
commit | 8134e1e575f862799c361b9c146eae7672010fa0 (patch) | |
tree | d4a43822c93cc88dbff69bc16febeadeca4282a4 /lib/Format/Format.cpp | |
parent | 4981bd0ca215570ef1e2e1c1c64a2c399069dc42 (diff) |
Don't put spaces around hyphens in include paths.
Before: #include <a - a>
After: #include <a-a>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172350 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r-- | lib/Format/Format.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 5de1717911..64a6224b0b 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -34,7 +34,7 @@ enum TokenType { TT_CastRParen, TT_ConditionalExpr, TT_CtorInitializerColon, - TT_DirectorySeparator, + TT_IncludePath, TT_LineComment, TT_ObjCBlockLParen, TT_ObjCDecl, @@ -834,12 +834,7 @@ public: void parseIncludeDirective() { while (CurrentToken != NULL) { - if (CurrentToken->is(tok::slash)) - CurrentToken->Type = TT_DirectorySeparator; - else if (CurrentToken->is(tok::less)) - CurrentToken->Type = TT_TemplateOpener; - else if (CurrentToken->is(tok::greater)) - CurrentToken->Type = TT_TemplateCloser; + CurrentToken->Type = TT_IncludePath; next(); } } @@ -1154,6 +1149,8 @@ private: (Tok.is(tok::equal) || Tok.Parent->is(tok::equal))) return false; + if (Tok.Type == TT_IncludePath) + return Tok.is(tok::less) || Tok.is(tok::string_literal); if (Tok.Type == TT_CtorInitializerColon || Tok.Type == TT_ObjCBlockLParen) return true; if (Tok.Type == TT_OverloadedOperator) @@ -1176,9 +1173,6 @@ private: return Tok.Type == TT_TemplateCloser && Tok.Parent->Type == TT_TemplateCloser && Style.SplitTemplateClosingGreater; } - if (Tok.Type == TT_DirectorySeparator || - Tok.Parent->Type == TT_DirectorySeparator) - return false; if (Tok.Type == TT_BinaryOperator || Tok.Parent->Type == TT_BinaryOperator) return true; if (Tok.Parent->Type == TT_TemplateCloser && Tok.is(tok::l_paren)) @@ -1206,6 +1200,8 @@ private: // Don't break at ':' if identifier before it can beak. return false; } + if (Right.Type == TT_IncludePath) + return false; if (Right.is(tok::colon) && Right.Type == TT_ObjCMethodExpr) return false; if (Left.is(tok::colon) && Left.Type == TT_ObjCMethodExpr) |