diff options
author | John McCall <rjmccall@apple.com> | 2010-08-21 22:46:04 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-08-21 22:46:04 +0000 |
commit | ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7 (patch) | |
tree | 646cd47265c995749e077b9f2e620436a5007436 /include | |
parent | ff58e3610f4e12094def69eb2d6dcb4330378d8f (diff) |
The ARM C++ ABI is sufficiently different from the Itanium C++ ABI that
it deserves its own enumerator. Obviously the implementations should
closely follow the Itanium ABI except in cases of divergence.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111749 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/TargetInfo.h | 29 | ||||
-rw-r--r-- | include/clang/Basic/TargetOptions.h | 5 |
2 files changed, 24 insertions, 10 deletions
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 11e009cb01..40df9ba11d 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -40,8 +40,17 @@ namespace Builtin { struct Info; } /// TargetCXXABI - The types of C++ ABIs for which we can generate code. enum TargetCXXABI { - CXXABI_Unknown = -1, + /// The generic ("Itanium") C++ ABI, documented at: + /// http://www.codesourcery.com/public/cxx-abi/ CXXABI_Itanium, + + /// The ARM C++ ABI, based largely on the Itanium ABI but with + /// significant differences. + /// http://infocenter.arm.com + /// /help/topic/com.arm.doc.ihi0041c/IHI0041C_cppabi.pdf + CXXABI_ARM, + + /// The Visual Studio ABI. Only scattered official documentation exists. CXXABI_Microsoft }; @@ -443,12 +452,22 @@ public: /// setCXXABI - Use this specific C++ ABI. /// /// \return - False on error (invalid C++ ABI name). - virtual bool setCXXABI(const std::string &Name) { - CXXABI = llvm::StringSwitch<TargetCXXABI>(Name) + bool setCXXABI(const std::string &Name) { + static const TargetCXXABI Unknown = static_cast<TargetCXXABI>(-1); + TargetCXXABI ABI = llvm::StringSwitch<TargetCXXABI>(Name) + .Case("arm", CXXABI_ARM) .Case("itanium", CXXABI_Itanium) .Case("microsoft", CXXABI_Microsoft) - .Default(CXXABI_Unknown); - if (CXXABI == CXXABI_Unknown) return false; + .Default(Unknown); + if (ABI == Unknown) return false; + return setCXXABI(ABI); + } + + /// setCXXABI - Set the C++ ABI to be used by this implementation. + /// + /// \return - False on error (ABI not valid on this target) + virtual bool setCXXABI(TargetCXXABI ABI) { + CXXABI = ABI; return true; } diff --git a/include/clang/Basic/TargetOptions.h b/include/clang/Basic/TargetOptions.h index b88b1f590e..f3c206f2cc 100644 --- a/include/clang/Basic/TargetOptions.h +++ b/include/clang/Basic/TargetOptions.h @@ -18,11 +18,6 @@ namespace clang { /// TargetOptions - Options for controlling the target. class TargetOptions { public: - - TargetOptions() { - CXXABI = "itanium"; - } - /// If given, the name of the target triple to compile for. If not given the /// target will be selected to match the host. std::string Triple; |