]> granicus.if.org Git - clang/commitdiff
fix the microsoft "charify" extension to return the charified token
authorChris Lattner <sabre@nondot.org>
Wed, 23 Dec 2009 19:15:27 +0000 (19:15 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 23 Dec 2009 19:15:27 +0000 (19:15 +0000)
as a character literal, not a string literal.  This might fix
rdar://7486575

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92025 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/MacroArgs.cpp
test/Parser/MicrosoftExtensions.c

index 34b1ef8fc0f074c808e76a7a9fa1aa449e3e6872..c2cf623317e3d7e8428dbda5e120b74fb0d204c2 100644 (file)
@@ -178,7 +178,7 @@ Token MacroArgs::StringifyArgument(const Token *ArgToks,
                                    Preprocessor &PP, bool Charify) {
   Token Tok;
   Tok.startToken();
-  Tok.setKind(tok::string_literal);
+  Tok.setKind(Charify ? tok::char_constant : tok::string_literal);
 
   const Token *ArgTokStart = ArgToks;
 
index 00618864648812ade48df5bef63c93f10701c93b..082929f6d843b2de91d3b26dd7ec5add9aff27e6 100644 (file)
@@ -28,3 +28,9 @@ void foo() {
 }
 
 typedef bool (__stdcall __stdcall *blarg)(int);
+
+
+// Charify extension.
+#define FOO(x) #@x
+char x = FOO(a);
+