From 79356eefc055c7dbd8960deee59a40aaeb266b9c Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Tue, 22 May 2018 06:09:23 +0000 Subject: GNUstep Objective-C ABI version 2 Summary: This includes initial support for the (hopefully final) updated Objective-C ABI, developed here: https://github.com/davidchisnall/clang-gnustep-abi-2 It also includes some cleanups and refactoring from older GNU ABIs. The current version is ELF only, other formats to follow. Reviewers: rjmccall, DHowett-MSFT Reviewed By: rjmccall Subscribers: smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D46052 llvm-svn: 332950 --- clang/lib/Frontend/InitPreprocessor.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'clang/lib/Frontend/InitPreprocessor.cpp') diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index f2182c8..5bdfa14 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -645,6 +645,19 @@ static void InitializePredefinedMacros(const TargetInfo &TI, if (LangOpts.ObjCRuntime.isNeXTFamily()) Builder.defineMacro("__NEXT_RUNTIME__"); + if (LangOpts.ObjCRuntime.getKind() == ObjCRuntime::GNUstep) { + auto version = LangOpts.ObjCRuntime.getVersion(); + std::string versionString = "1"; + // Don't rely on the tuple argument, because we can be asked to target + // later ABIs than we actually support, so clamp these values to those + // currently supported + if (version >= VersionTuple(2, 0)) + Builder.defineMacro("__OBJC_GNUSTEP_RUNTIME_ABI__", "20"); + else + Builder.defineMacro("__OBJC_GNUSTEP_RUNTIME_ABI__", + "1" + Twine(std::min(8U, version.getMinor().getValueOr(0)))); + } + if (LangOpts.ObjCRuntime.getKind() == ObjCRuntime::ObjFW) { VersionTuple tuple = LangOpts.ObjCRuntime.getVersion(); -- cgit v1.1