]> granicus.if.org Git - clang/commitdiff
Don't accept '$' in identifiers in assembler-with-cpp mode.
authorDaniel Dunbar <daniel@zuster.org>
Sun, 15 Mar 2009 00:11:28 +0000 (00:11 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sun, 15 Mar 2009 00:11:28 +0000 (00:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67013 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/clang.cpp
test/Lexer/dollar-idents.c [new file with mode: 0644]

index a58e877f988d7cd2d11947664d1798bbf43c10ff..e94f0ed07cbe8689210371a27f009295b322216e 100644 (file)
@@ -644,7 +644,9 @@ static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
   if (!Options.ObjC1 && LangStd < lang_gnu_START)
     Options.Blocks = 0;
   
-  Options.DollarIdents = 1;  // FIXME: Really a target property.
+  // Never accept '$' in identifiers when preprocessing assembler.
+  if (LK != langkind_asm_cpp)
+    Options.DollarIdents = 1;  // FIXME: Really a target property.
   if (PascalStrings.getPosition())
     Options.PascalStrings = PascalStrings;
   Options.Microsoft = MSExtensions;
diff --git a/test/Lexer/dollar-idents.c b/test/Lexer/dollar-idents.c
new file mode 100644 (file)
index 0000000..068ba68
--- /dev/null
@@ -0,0 +1,7 @@
+// RUN: clang -dump-tokens %s &> %t &&
+// RUN: grep "identifier '\$A'" %t
+// RUN: clang -dump-tokens -x assembler-with-cpp %s &> %t &&
+// RUN: grep "identifier 'A'" %t
+// PR3808
+
+$A