[cfe-commits] r72283 - in /cfe/trunk: lib/Lex/PPDirectives.cpp test/Preprocessor/assembler-with-cpp.c
Daniel Dunbar
daniel at zuster.org
Fri May 22 14:35:34 PDT 2009
Author: ddunbar
Date: Fri May 22 16:35:34 2009
New Revision: 72283
URL: http://llvm.org/viewvc/llvm-project?rev=72283&view=rev
Log:
In assembler-with-cpp mode, don't error on '#' (stringize) operator applied to
non-argument names, pass the tokens through.
Modified:
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/test/Preprocessor/assembler-with-cpp.c
Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=72283&r1=72282&r2=72283&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Fri May 22 16:35:34 2009
@@ -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);
Modified: cfe/trunk/test/Preprocessor/assembler-with-cpp.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/assembler-with-cpp.c?rev=72283&r1=72282&r2=72283&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/assembler-with-cpp.c (original)
+++ cfe/trunk/test/Preprocessor/assembler-with-cpp.c Fri May 22 16:35:34 2009
@@ -29,6 +29,8 @@
2: '
3: "
+// (balance quotes to keep editors happy): "'
+
// Empty char literals are ok.
// RUN: grep "4: ''" %t &&
4: ''
@@ -53,4 +55,12 @@
7: FOO(blarg)
+//
+#define T6() T6 #nostring
+#define T7(x) T7 #x
+T6()
+T7(foo)
+// RUN: grep 'T6 #nostring' %t &&
+// RUN: grep 'T7 "foo"' %t &&
+
// RUN: true
More information about the cfe-commits
mailing list