[clang] 1e487e4 - clang: Only define OBJC_NEW_PROPERTIES when -x objective-c
Duncan P. N. Exon Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 24 14:55:26 PST 2020
Author: Duncan P. N. Exon Smith
Date: 2020-01-24T14:55:12-08:00
New Revision: 1e487e4c16821b6de3d651f618274df90bd3fad9
URL: https://github.com/llvm/llvm-project/commit/1e487e4c16821b6de3d651f618274df90bd3fad9
DIFF: https://github.com/llvm/llvm-project/commit/1e487e4c16821b6de3d651f618274df90bd3fad9.diff
LOG: clang: Only define OBJC_NEW_PROPERTIES when -x objective-c
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).
https://reviews.llvm.org/D72970
rdar://problem/10050342
Added:
Modified:
clang/lib/Basic/Targets/OSTargets.cpp
clang/test/Preprocessor/init.c
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/OSTargets.cpp b/clang/lib/Basic/Targets/OSTargets.cpp
index d4ffffc64ba8..187944146bde 100644
--- a/clang/lib/Basic/Targets/OSTargets.cpp
+++ b/clang/lib/Basic/Targets/OSTargets.cpp
@@ -25,7 +25,7 @@ void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
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))
diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
index e25946304d0f..6c9508e5c634 100644
--- a/clang/test/Preprocessor/init.c
+++ b/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
More information about the cfe-commits
mailing list