summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2017-07-14 09:23:40 +0000
committerOlivier Goffart <ogoffart@woboq.com>2017-07-14 09:23:40 +0000
commit90f981bc5bbe053e3ef4d25f463f5eff0cbe6daf (patch)
tree199486ce35777ab9ea84af644f8fcfd4cf0fc5c5 /clang/lib/Lex/Preprocessor.cpp
parenta84f9f5364207f71f2d5aafdbc63ab8e0f026d77 (diff)
downloadbcm5719-llvm-90f981bc5bbe053e3ef4d25f463f5eff0cbe6daf.tar.gz
bcm5719-llvm-90f981bc5bbe053e3ef4d25f463f5eff0cbe6daf.zip
Keep the IdentifierInfo in the Token for alternative operator keyword
The goal of this commit is to fix clang-format so it does not merge tokens when using the alternative spelling keywords. (eg: "not foo" should not become "notfoo") The problem is that Preprocessor::HandleIdentifier used to drop the identifier info from the token for these keyword. This means the first condition of TokenAnnotator::spaceRequiredBefore is not met. We could add explicit check for the spelling in that condition, but I think it is better to keep the IdentifierInfo and handle the operator keyword explicitly when needed. That actually leads to simpler code, and probably slightly more efficient as well. Another side effect of this change is that __identifier(and) will now work as one would expect, removing a FIXME from the MicrosoftExtensions.cpp test Differential Revision: https://reviews.llvm.org/D35172 llvm-svn: 308008
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp8
1 files changed, 0 insertions, 8 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 63f39524d12..d1dc8e1c001 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -712,14 +712,6 @@ bool Preprocessor::HandleIdentifier(Token &Identifier) {
II.setIsFutureCompatKeyword(false);
}
- // C++ 2.11p2: If this is an alternative representation of a C++ operator,
- // then we act as if it is the actual operator and not the textual
- // representation of it.
- if (II.isCPlusPlusOperatorKeyword() &&
- !(getLangOpts().MSVCCompat &&
- getSourceManager().isInSystemHeader(Identifier.getLocation())))
- Identifier.setIdentifierInfo(nullptr);
-
// If this is an extension token, diagnose its use.
// We avoid diagnosing tokens that originate from macro definitions.
// FIXME: This warning is disabled in cases where it shouldn't be,
OpenPOWER on IntegriCloud