diff options
author | Daniel Jasper <djasper@google.com> | 2015-06-11 08:38:19 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-06-11 08:38:19 +0000 |
commit | 229628b39e1eaedc9870824786ee32ca8cd0c5c2 (patch) | |
tree | b9b7fe4f48d48887699bbf0056d43310ec21512b /clang/lib/Format/Format.cpp | |
parent | e0e228a380585e538073ded404c7e009b9458f42 (diff) | |
download | llvm-229628b39e1eaedc9870824786ee32ca8cd0c5c2.zip llvm-229628b39e1eaedc9870824786ee32ca8cd0c5c2.tar.gz llvm-229628b39e1eaedc9870824786ee32ca8cd0c5c2.tar.bz2 |
clang-format: Don't add spaces in foreach macro definition.
Before clang-format would e.g. add a space into
#define Q_FOREACH(x, y)
which turns this into a non-function-like macro.
Patch by Strager Neds, thank you!
llvm-svn: 239513
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index c725b4b..a774f8c 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1122,7 +1122,10 @@ private: Column = FormatTok->LastLineColumnWidth; } - if (std::find(ForEachMacros.begin(), ForEachMacros.end(), + if (!(Tokens.size() > 0 && Tokens.back()->Tok.getIdentifierInfo() && + Tokens.back()->Tok.getIdentifierInfo()->getPPKeywordID() == + tok::pp_define) && + std::find(ForEachMacros.begin(), ForEachMacros.end(), FormatTok->Tok.getIdentifierInfo()) != ForEachMacros.end()) FormatTok->Type = TT_ForEachMacro; |