summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-05-31 03:38:08 +0000
committerAlp Toker <alp@nuanti.com>2014-05-31 03:38:08 +0000
commitf33619cb51c7b1a77f2063f5bb6be8dda81bf7c5 (patch)
treee192449b69c14154293b45bdb10949ef65cd334a /clang/lib/Lex
parent6913f1a95caeb2e70d16f2acc13a9f7a02992666 (diff)
downloadbcm5719-llvm-f33619cb51c7b1a77f2063f5bb6be8dda81bf7c5.tar.gz
bcm5719-llvm-f33619cb51c7b1a77f2063f5bb6be8dda81bf7c5.zip
Preprocessor: don't exit early in CheckMacroName()
The checks below can hypothetically apply to converted operator name identifiers. In practice there are no builtin macros etc. with those names so there's no behavioural change to test. llvm-svn: 209962
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index a7a4bbcc45f..78b84e2d469 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -140,22 +140,19 @@ bool Preprocessor::CheckMacroName(Token &MacroNameTok, char isDefineUndef) {
std::string Spelling = getSpelling(MacroNameTok, &Invalid);
if (Invalid)
return Diag(MacroNameTok, diag::err_pp_macro_not_identifier);
+ II = getIdentifierInfo(Spelling);
- const IdentifierInfo &Info = Identifiers.get(Spelling);
-
- // Allow #defining |and| and friends in microsoft mode.
- if (Info.isCPlusPlusOperatorKeyword() && getLangOpts().MSVCCompat) {
- MacroNameTok.setIdentifierInfo(getIdentifierInfo(Spelling));
- return false;
- }
+ if (!II->isCPlusPlusOperatorKeyword())
+ return Diag(MacroNameTok, diag::err_pp_macro_not_identifier);
- if (Info.isCPlusPlusOperatorKeyword())
+ if (!getLangOpts().MSVCCompat)
// C++ 2.5p2: Alternative tokens behave the same as its primary token
// except for their spellings.
return Diag(MacroNameTok, diag::err_pp_operator_used_as_macro_name)
- << Spelling << MacroNameTok.getKind();
+ << II << MacroNameTok.getKind();
- return Diag(MacroNameTok, diag::err_pp_macro_not_identifier);
+ // Allow #defining |and| and friends for Microsoft compatibility.
+ MacroNameTok.setIdentifierInfo(II);
}
if (isDefineUndef && II->getPPKeywordID() == tok::pp_defined) {
OpenPOWER on IntegriCloud