summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-12-20 12:03:13 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-12-20 12:03:13 +0000
commita8df444a1ce264b7c52eba86d0339db198cd50cb (patch)
tree170fe38c0a1674244f58d31abde72a2e9fb4b01e
parent9da3dd0415878f932d62263fbec2476be7cd226a (diff)
downloadbcm5719-llvm-a8df444a1ce264b7c52eba86d0339db198cd50cb.tar.gz
bcm5719-llvm-a8df444a1ce264b7c52eba86d0339db198cd50cb.zip
Add __has_feature(memory_sanitizer).
llvm-svn: 170686
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp1
-rw-r--r--clang/test/Lexer/has_feature_memory_sanitizer.cpp11
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 941c2d47d09..d2f1b5f05d7 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -780,6 +780,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
.Case("cxx_exceptions", LangOpts.Exceptions)
.Case("cxx_rtti", LangOpts.RTTI)
.Case("enumerator_attributes", true)
+ .Case("memory_sanitizer", LangOpts.SanitizeMemory)
.Case("thread_sanitizer", LangOpts.SanitizeThread)
// Objective-C features
.Case("objc_arr", LangOpts.ObjCAutoRefCount) // FIXME: REMOVE?
diff --git a/clang/test/Lexer/has_feature_memory_sanitizer.cpp b/clang/test/Lexer/has_feature_memory_sanitizer.cpp
new file mode 100644
index 00000000000..3ebb9e13682
--- /dev/null
+++ b/clang/test/Lexer/has_feature_memory_sanitizer.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -E -fsanitize=memory %s -o - | FileCheck --check-prefix=CHECK-MSAN %s
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-MSAN %s
+
+#if __has_feature(memory_sanitizer)
+int MemorySanitizerEnabled();
+#else
+int MemorySanitizerDisabled();
+#endif
+
+// CHECK-MSAN: MemorySanitizerEnabled
+// CHECK-NO-MSAN: MemorySanitizerDisabled
OpenPOWER on IntegriCloud