"pasting formed '%0', an invalid preprocessing token">, DefaultError,
InGroup<DiagGroup<"invalid-token-paste">>;
def err_pp_operator_used_as_macro_name : Error<
- "C++ operator '%0' (aka %1) cannot be used as a macro name">;
+ "C++ operator %0 (aka %1) cannot be used as a macro name">;
def err_pp_illegal_floating_literal : Error<
"floating point literal in preprocessor expression">;
def err_pp_line_requires_integer : Error<
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) {