In assembler-with-cpp mode, don't error on '#' (stringize) operator applied to
non-argument names, pass the tokens through.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72283 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp
index 331424b..d7b8fc7 100644
--- a/lib/Lex/PPDirectives.cpp
+++ b/lib/Lex/PPDirectives.cpp
@@ -1376,9 +1376,11 @@
// Get the next token of the macro.
LexUnexpandedToken(Tok);
- // Not a macro arg identifier?
- if (!Tok.getIdentifierInfo() ||
- MI->getArgumentNum(Tok.getIdentifierInfo()) == -1) {
+ // Check for a valid macro arg identifier, unless this is a .S file in
+ // which case it is still added to the body.
+ if ((!Tok.getIdentifierInfo() ||
+ MI->getArgumentNum(Tok.getIdentifierInfo()) == -1) &&
+ !getLangOptions().AsmPreprocessor) {
Diag(Tok, diag::err_pp_stringize_not_parameter);
ReleaseMacroInfo(MI);