summaryrefslogtreecommitdiff
path: root/test/Parser
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
commitbaa150782312a70256b17d5383d7a5cd6c8dec32 (patch)
tree9075324d5beb893ad0816646da05ee336cae9192 /test/Parser
parent655f74219d46484a8df5be7b18a05dab8a8a4275 (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308008 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser')
-rw-r--r--test/Parser/MicrosoftExtensions.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp
index 74f4bb3268..c796eded1f 100644
--- a/test/Parser/MicrosoftExtensions.cpp
+++ b/test/Parser/MicrosoftExtensions.cpp
@@ -261,9 +261,7 @@ int __identifier(else} = __identifier(for); // expected-error {{missing ')' afte
#define identifier_weird(x) __identifier(x
int k = identifier_weird(if)); // expected-error {{use of undeclared identifier 'if'}}
-// This is a bit weird, but the alternative tokens aren't keywords, and this
-// behavior matches MSVC. FIXME: Consider supporting this anyway.
-extern int __identifier(and) r; // expected-error {{cannot convert '&&' token to an identifier}}
+extern int __identifier(and);
void f() {
__identifier(() // expected-error {{cannot convert '(' token to an identifier}}