summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-06-16 00:03:19 +0000
committerJohn McCall <rjmccall@apple.com>2011-06-16 00:03:19 +0000
commit5d36a8cc700ef258df055baf95a248f854444f36 (patch)
treec618f01bbff6e1df99435ec67aab339a00d01f16 /clang
parent8b098b0d57784080eb3518bad5d4fdfba411ab7a (diff)
downloadbcm5719-llvm-5d36a8cc700ef258df055baf95a248f854444f36.tar.gz
bcm5719-llvm-5d36a8cc700ef258df055baf95a248f854444f36.zip
Unconditionally #define the ARC ownership qualifiers, instead of #defining
them only on Darwin tool chains. llvm-svn: 133112
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Basic/Targets.cpp9
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp9
2 files changed, 10 insertions, 8 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 541a1ed5954..40840275dab 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -84,14 +84,7 @@ static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
Builder.defineMacro("__MACH__");
Builder.defineMacro("OBJC_NEW_PROPERTIES");
- if (Opts.ObjCAutoRefCount) {
- Builder.defineMacro("__weak", "__attribute__((objc_lifetime(weak)))");
- Builder.defineMacro("__strong", "__attribute__((objc_lifetime(strong)))");
- Builder.defineMacro("__autoreleasing",
- "__attribute__((objc_lifetime(autoreleasing)))");
- Builder.defineMacro("__unsafe_unretained",
- "__attribute__((objc_lifetime(none)))");
- } else {
+ if (!Opts.ObjCAutoRefCount) {
// __weak is always defined, for use in blocks and with objc pointers.
Builder.defineMacro("__weak", "__attribute__((objc_gc(weak)))");
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index f1e1d47713b..e1c394ea754 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -606,6 +606,15 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
if (LangOpts.FastRelaxedMath)
Builder.defineMacro("__FAST_RELAXED_MATH__");
+ if (LangOpts.ObjCAutoRefCount) {
+ Builder.defineMacro("__weak", "__attribute__((objc_lifetime(weak)))");
+ Builder.defineMacro("__strong", "__attribute__((objc_lifetime(strong)))");
+ Builder.defineMacro("__autoreleasing",
+ "__attribute__((objc_lifetime(autoreleasing)))");
+ Builder.defineMacro("__unsafe_unretained",
+ "__attribute__((objc_lifetime(none)))");
+ }
+
// Get other target #defines.
TI.getTargetDefines(LangOpts, Builder);
}
OpenPOWER on IntegriCloud