diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-12-20 12:03:13 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-12-20 12:03:13 +0000 |
commit | 5c70ef4ae43dbfd501bedb8e8952fc3881527110 (patch) | |
tree | ced5516e75b87c8166dd98fc8b9c0d6f2c9887cc | |
parent | ad7bb3601d57e7d41c199a4367490b705f669e67 (diff) |
Add __has_feature(memory_sanitizer).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170686 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Lex/PPMacroExpansion.cpp | 1 | ||||
-rw-r--r-- | test/Lexer/has_feature_memory_sanitizer.cpp | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 941c2d47d0..d2f1b5f05d 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/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/test/Lexer/has_feature_memory_sanitizer.cpp b/test/Lexer/has_feature_memory_sanitizer.cpp new file mode 100644 index 0000000000..3ebb9e1368 --- /dev/null +++ b/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 |