__CONSTANT_CFSTRINGS__ should be defined even in C mode, otherwise the CFSTR

won't expand to the builtin.  This fixes rdar://6248329

llvm-svn: 57164
This commit is contained in:
Chris Lattner 2008-10-06 07:43:09 +00:00
parent a97132a9c4
commit 1b0a00a4c9
2 changed files with 17 additions and 4 deletions

View File

@ -488,12 +488,12 @@ static void InitializePredefinedMacros(Preprocessor &PP,
if (PP.getLangOptions().NeXTRuntime)
DefineBuiltinMacro(Buf, "__NEXT_RUNTIME__=1");
// darwin_constant_cfstrings controls this. This is also dependent
// on other things like the runtime I believe.
DefineBuiltinMacro(Buf, "__CONSTANT_CFSTRINGS__=1");
}
// darwin_constant_cfstrings controls this. This is also dependent
// on other things like the runtime I believe. This is set even for C code.
DefineBuiltinMacro(Buf, "__CONSTANT_CFSTRINGS__=1");
if (PP.getLangOptions().ObjC2)
DefineBuiltinMacro(Buf, "OBJC_NEW_PROPERTIES");

View File

@ -0,0 +1,13 @@
// RUN: clang -emit-llvm %s -o %t
#ifdef __APPLE__
#include <Carbon/Carbon.h>
void f() {
CFSTR("Hello, World!");
}
// rdar://6248329
void *G = CFSTR("yo joe");
#endif