summaryrefslogtreecommitdiffstats
path: root/clang/test/Lexer/has_feature_exceptions.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-12-03 01:34:15 +0000
committerTed Kremenek <kremenek@apple.com>2009-12-03 01:34:15 +0000
commit5ef26fb4fd9d6a3ac7b35eb5f3a2a4814449a28f (patch)
tree0531be5c68a32879b0682e78b65ca83fbfb9e250 /clang/test/Lexer/has_feature_exceptions.cpp
parent26ada867bae2d3ecbc938dc36c4a4e10c1e17a93 (diff)
downloadbcm5719-llvm-5ef26fb4fd9d6a3ac7b35eb5f3a2a4814449a28f.tar.gz
bcm5719-llvm-5ef26fb4fd9d6a3ac7b35eb5f3a2a4814449a28f.zip
Add 'has_feature(cxx_exceptions)' to allow code to determine via preprocessor logic if C++ exceptions are enabled.
llvm-svn: 90378
Diffstat (limited to 'clang/test/Lexer/has_feature_exceptions.cpp')
-rw-r--r--clang/test/Lexer/has_feature_exceptions.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/Lexer/has_feature_exceptions.cpp b/clang/test/Lexer/has_feature_exceptions.cpp
new file mode 100644
index 00000000000..231a6c56a45
--- /dev/null
+++ b/clang/test/Lexer/has_feature_exceptions.cpp
@@ -0,0 +1,11 @@
+// RUN: clang -E -fexceptions %s -o - | FileCheck --check-prefix=CHECK-EXCEPTIONS %s
+// RUN: clang -E -fno-exceptions %s -o - | FileCheck --check-prefix=CHECK-NO-EXCEPTIONS %s
+
+#if __has_feature(cxx_exceptions)
+int foo();
+#else
+int bar();
+#endif
+
+// CHECK-EXCEPTIONS: foo
+// CHECK-NO-EXCEPTIONS: bar
OpenPOWER on IntegriCloud