Something like this?
On Fri, Jan 20, 2012 at 2:53 PM, James Molloy <[email protected]> wrote:
> I agree too.
>
> Cheers,
>
> James
>
> -----Original Message-----
> From: Anton Korobeynikov [mailto:[email protected]]
> Sent: 20 January 2012 10:52
> To: John McCall
> Cc: James Molloy; [email protected]
> Subject: Re: [cfe-commits] [PATCH] Extend unwind.h with the ARM unwinder
> interface
>
>> I agree. Since this is a Clang-specific header, though, we should use
>> __has_feature. Maybe __has_feature(arm_exceptions_abi)?
> Sounds like great idea!
>
> --
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged. If you are not the intended
> recipient, please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy the
> information in any medium. Thank you.
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Index: test/Preprocessor/arm-exceptions-abi2.c
===================================================================
--- test/Preprocessor/arm-exceptions-abi2.c (revision 0)
+++ test/Preprocessor/arm-exceptions-abi2.c (revision 0)
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -triple=arm-linux-eabi
+// RUN: %clang_cc1 %s -triple=arm-linux-gnueabi
+
+#if !__has_feature(arm_exceptions_abi)
+#error Bad
+#endif
Index: test/Preprocessor/arm-exceptions-abi.c
===================================================================
--- test/Preprocessor/arm-exceptions-abi.c (revision 0)
+++ test/Preprocessor/arm-exceptions-abi.c (revision 0)
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 %s -triple=arm-apple-darwin9
+// RUN: %clang_cc1 %s -triple=i686-apple-darwin9
+// RUN: %clang_cc1 %s -triple=i686-pc-linux-gnu
+
+#if __has_feature(arm_exceptions_abi)
+#error Bad
+#endif
Index: include/clang/Basic/TargetInfo.h
===================================================================
--- include/clang/Basic/TargetInfo.h (revision 148474)
+++ include/clang/Basic/TargetInfo.h (working copy)
@@ -57,6 +57,11 @@
CXXABI_Microsoft
};
+enum TargetExceptionsABI {
+ ExceptionsABI_None,
+ ExceptionsABI_ARM
+};
+
/// TargetInfo - This class exposes information about the current target.
///
class TargetInfo : public llvm::RefCountedBase<TargetInfo> {
@@ -86,6 +91,7 @@
*LongDoubleFormat;
unsigned char RegParmMax, SSERegParmMax;
TargetCXXABI CXXABI;
+ TargetExceptionsABI ExceptionsABI;
const LangAS::Map *AddrSpaceMap;
mutable StringRef PlatformName;
@@ -526,6 +532,11 @@
return CXXABI;
}
+ /// getExceptionsABI - Get the exceptions ABI in use.
+ virtual TargetExceptionsABI getExceptionsABI() const {
+ return ExceptionsABI;
+ }
+
/// setCPU - Target the specific CPU.
///
/// \return - False on error (invalid CPU name).
Index: lib/Basic/TargetInfo.cpp
===================================================================
--- lib/Basic/TargetInfo.cpp (revision 148474)
+++ lib/Basic/TargetInfo.cpp (working copy)
@@ -82,6 +82,9 @@
// Default to using the Itanium ABI.
CXXABI = CXXABI_Itanium;
+ // Default to no expections ABI.
+ ExceptionsABI = ExceptionsABI_None;
+
// Default to an empty address space map.
AddrSpaceMap = &DefaultAddrSpaceMap;
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp (revision 148474)
+++ lib/Basic/Targets.cpp (working copy)
@@ -2592,6 +2592,9 @@
// ARM targets default to using the ARM C++ ABI.
CXXABI = CXXABI_ARM;
+ // ARM targets default to using the ARM EH ABI.
+ ExceptionsABI = ExceptionsABI_ARM;
+
// ARM has atomics up to 8 bytes
// FIXME: Set MaxAtomicInlineWidth if we have the feature v6e
MaxAtomicPromoteWidth = 64;
@@ -2917,6 +2920,8 @@
// iOS always has 64-bit atomic instructions.
// FIXME: This should be based off of the target features in ARMTargetInfo.
MaxAtomicInlineWidth = 64;
+
+ ExceptionsABI = ExceptionsABI_None;
}
};
} // end anonymous namespace.
Index: lib/Lex/PPMacroExpansion.cpp
===================================================================
--- lib/Lex/PPMacroExpansion.cpp (revision 148474)
+++ lib/Lex/PPMacroExpansion.cpp (working copy)
@@ -703,6 +703,8 @@
.Case("modules", LangOpts.Modules)
.Case("tls", PP.getTargetInfo().isTLSSupported())
.Case("underlying_type", LangOpts.CPlusPlus)
+ .Case("arm_exceptions_abi",
+ PP.getTargetInfo().getExceptionsABI()==ExceptionsABI_ARM)
.Default(false);
}
Index: lib/Headers/unwind.h
===================================================================
--- lib/Headers/unwind.h (revision 148474)
+++ lib/Headers/unwind.h (working copy)
@@ -56,7 +56,7 @@
} _Unwind_Reason_Code;
-#ifdef __arm__
+#if __has_feature(arm_exceptions_abi)
typedef enum {
_UVRSC_CORE = 0, /* integer register */
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits