diff options
author | Daniel Jasper <djasper@google.com> | 2015-08-14 12:44:06 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-08-14 12:44:06 +0000 |
commit | d788457da5c767c1517fc33554818d979f77867f (patch) | |
tree | ad64f28aa58b226b451db2381dfd329ad3d6bb90 /clang/lib/Format | |
parent | 8cc024ee370ee98ac5d900146ffd7da495a0272e (diff) | |
download | bcm5719-llvm-d788457da5c767c1517fc33554818d979f77867f.tar.gz bcm5719-llvm-d788457da5c767c1517fc33554818d979f77867f.zip |
clang-format: Don't remove space between #elif and parentheses.
Before:
#elif(AAAA && BBBB)
After:
#elif (AAAA && BBBB)
llvm-svn: 245043
Diffstat (limited to 'clang/lib/Format')
-rw-r--r-- | clang/lib/Format/FormatToken.h | 4 | ||||
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h index f335eda086c..c5db18c8e0e 100644 --- a/clang/lib/Format/FormatToken.h +++ b/clang/lib/Format/FormatToken.h @@ -283,6 +283,10 @@ struct FormatToken { bool is(const IdentifierInfo *II) const { return II && II == Tok.getIdentifierInfo(); } + bool is(tok::PPKeywordKind Kind) const { + return Tok.getIdentifierInfo() && + Tok.getIdentifierInfo()->getPPKeywordID() == Kind; + } template <typename A, typename B> bool isOneOf(A K1, B K2) const { return is(K1) || is(K2); } diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 41d1811541a..26d358267b9 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1895,7 +1895,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, return true; return Line.Type == LT_ObjCDecl || Left.is(tok::semi) || (Style.SpaceBeforeParens != FormatStyle::SBPO_Never && - (Left.isOneOf(tok::kw_if, tok::kw_for, tok::kw_while, + (Left.isOneOf(tok::kw_if, tok::pp_elif, tok::kw_for, tok::kw_while, tok::kw_switch, tok::kw_case, TT_ForEachMacro) || (Left.isOneOf(tok::kw_try, Keywords.kw___except, tok::kw_catch, tok::kw_new, tok::kw_delete) && |