summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-04-22 09:45:42 +0000
committerDaniel Jasper <djasper@google.com>2015-04-22 09:45:42 +0000
commitee4a8a140ac653ef8a2ff03ee0c828906aac2de5 (patch)
tree8f93799cc3d271d47b0e0bcecd0571d497b12779 /clang/lib/Format/TokenAnnotator.cpp
parentcd2334e86e018757b5a51eb16e5a814a6d95bded (diff)
downloadbcm5719-llvm-ee4a8a140ac653ef8a2ff03ee0c828906aac2de5.tar.gz
bcm5719-llvm-ee4a8a140ac653ef8a2ff03ee0c828906aac2de5.zip
clang-format: Fix for #pragma option formatting.
Adapted patch from Sergey Razmetov. Thank you. llvm-svn: 235492
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index ea5503ade68..7733b8a6e95 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -582,11 +582,14 @@ private:
void parsePragma() {
next(); // Consume "pragma".
- if (CurrentToken && CurrentToken->TokenText == "mark") {
+ if (CurrentToken &&
+ CurrentToken->isOneOf(Keywords.kw_mark, Keywords.kw_option)) {
+ bool IsMark = CurrentToken->is(Keywords.kw_mark);
next(); // Consume "mark".
next(); // Consume first token (so we fix leading whitespace).
while (CurrentToken) {
- CurrentToken->Type = TT_ImplicitStringLiteral;
+ if (IsMark || CurrentToken->Previous->is(TT_BinaryOperator))
+ CurrentToken->Type = TT_ImplicitStringLiteral;
next();
}
}
OpenPOWER on IntegriCloud