diff options
-rw-r--r-- | Driver/clang.cpp | 4 | ||||
-rw-r--r-- | test/Lexer/dollar-idents.c | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp index a58e877f98..e94f0ed07c 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -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 index 0000000000..068ba68614 --- /dev/null +++ b/test/Lexer/dollar-idents.c @@ -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 |