diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Basic/ObjCRuntime.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 16 | ||||
-rw-r--r-- | clang/lib/Lex/PPMacroExpansion.cpp | 1 |
3 files changed, 22 insertions, 3 deletions
diff --git a/clang/lib/Basic/ObjCRuntime.cpp b/clang/lib/Basic/ObjCRuntime.cpp index 9bd433a0649..be50fc4fe24 100644 --- a/clang/lib/Basic/ObjCRuntime.cpp +++ b/clang/lib/Basic/ObjCRuntime.cpp @@ -71,16 +71,20 @@ bool ObjCRuntime::tryParse(StringRef input) { kind = ObjCRuntime::GCC; } else if (runtimeName == "objfw") { kind = ObjCRuntime::ObjFW; + Version = VersionTuple(0, 8); } else { return true; } TheKind = kind; - + if (dash != StringRef::npos) { StringRef verString = input.substr(dash + 1); - if (Version.tryParse(verString)) + if (Version.tryParse(verString)) return true; } + if (kind == ObjCRuntime::ObjFW && Version > VersionTuple(0, 8)) + Version = VersionTuple(0, 8); + return false; } diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 0d76069a843..8703a67a6f9 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -408,6 +408,22 @@ static void InitializePredefinedMacros(const TargetInfo &TI, if (LangOpts.ObjCRuntime.isNeXTFamily()) Builder.defineMacro("__NEXT_RUNTIME__"); + if (LangOpts.ObjCRuntime.getKind() == ObjCRuntime::ObjFW) { + VersionTuple tuple = LangOpts.ObjCRuntime.getVersion(); + + unsigned minor = 0; + if (tuple.getMinor().hasValue()) + minor = tuple.getMinor().getValue(); + + unsigned subminor = 0; + if (tuple.getSubminor().hasValue()) + subminor = tuple.getSubminor().getValue(); + + Builder.defineMacro("__OBJFW_RUNTIME_ABI__", + Twine(tuple.getMajor() * 10000 + minor * 100 + + subminor)); + } + Builder.defineMacro("IBOutlet", "__attribute__((iboutlet))"); Builder.defineMacro("IBOutletCollection(ClassName)", "__attribute__((iboutletcollection(ClassName)))"); diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 0a4610d06c8..8b81d5943b2 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -920,7 +920,6 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) { .Case("objc_nonfragile_abi", LangOpts.ObjCRuntime.isNonFragile()) .Case("objc_property_explicit_atomic", true) // Does clang support explicit "atomic" keyword? .Case("objc_weak_class", LangOpts.ObjCRuntime.hasWeakClassImport()) - .Case("objc_msg_lookup_stret", LangOpts.ObjCRuntime.getKind() == ObjCRuntime::ObjFW) .Case("ownership_holds", true) .Case("ownership_returns", true) .Case("ownership_takes", true) |