From: Daniel Dunbar Date: Sun, 15 Mar 2009 00:11:28 +0000 (+0000) Subject: Don't accept '$' in identifiers in assembler-with-cpp mode. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=85c491064b33e8d407166256a9e639bc1fcad4ef;p=clang Don't accept '$' in identifiers in assembler-with-cpp mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67013 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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