aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Lex/Preprocessor.cpp8
-rw-r--r--test/CodeGen/cfstring2.c13
2 files changed, 17 insertions, 4 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index 6c5daae13b..ed69e6f933 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -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");
diff --git a/test/CodeGen/cfstring2.c b/test/CodeGen/cfstring2.c
new file mode 100644
index 0000000000..605b9d5d41
--- /dev/null
+++ b/test/CodeGen/cfstring2.c
@@ -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