[PATCH] D72970: clang: Only define OBJC_NEW_PROPERTIES when -x objective-c

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 17 17:42:48 PST 2020


dexonsmith created this revision.
dexonsmith added reviewers: rjmccall, arphaman.
Herald added a subscriber: ributzka.

Since 2009 (in r63846) we've been `#define`-ing OBJC_NEW_PROPERTIES all
the time on Darwin, but this macro only makes sense for `-x objective-c`
and `-x objective-c++`.  Restrict it to those cases (for which there is
already separate logic).

rdar://problem/10050342


https://reviews.llvm.org/D72970

Files:
  clang/lib/Basic/Targets/OSTargets.cpp
  clang/test/Preprocessor/init.c


Index: clang/test/Preprocessor/init.c
===================================================================
--- clang/test/Preprocessor/init.c
+++ clang/test/Preprocessor/init.c
@@ -187,6 +187,7 @@
 //
 //
 // RUN: %clang_cc1 -x objective-c -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix OBJC %s
+// RUN: %clang_cc1 -x objective-c++ -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix OBJC %s
 //
 // OBJC:#define OBJC_NEW_PROPERTIES 1
 // OBJC:#define __NEXT_RUNTIME__ 1
@@ -9272,6 +9273,7 @@
 // RUN:   -fgnuc-version=4.2.1 -triple=aarch64-apple-macosx10.12 < /dev/null \
 // RUN: | FileCheck -check-prefix=DARWIN %s
 
+// DARWIN-NOT: OBJC_NEW_PROPERTIES
 // DARWIN:#define __STDC_NO_THREADS__ 1
 
 // RUN: %clang_cc1 -triple i386-apple-macosx -ffreestanding -dM -E /dev/null -o - | FileCheck -match-full-lines -check-prefix MACOS-32 %s
Index: clang/lib/Basic/Targets/OSTargets.cpp
===================================================================
--- clang/lib/Basic/Targets/OSTargets.cpp
+++ clang/lib/Basic/Targets/OSTargets.cpp
@@ -25,7 +25,7 @@
   Builder.defineMacro("__APPLE_CC__", "6000");
   Builder.defineMacro("__APPLE__");
   Builder.defineMacro("__STDC_NO_THREADS__");
-  Builder.defineMacro("OBJC_NEW_PROPERTIES");
+
   // AddressSanitizer doesn't play well with source fortification, which is on
   // by default on Darwin.
   if (Opts.Sanitize.has(SanitizerKind::Address))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72970.238934.patch
Type: text/x-patch
Size: 1418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200118/b33dd9a9/attachment.bin>


More information about the cfe-commits mailing list