[cfe-commits] [PATCH] Add __has_feature(memory_sanitizer)

Evgeniy Stepanov eugenis at google.com
Thu Dec 20 03:55:59 PST 2012


Hi kcc,

http://llvm-reviews.chandlerc.com/D227

Files:
  test/Lexer/has_feature_memory_sanitizer.cpp
  lib/Lex/PPMacroExpansion.cpp

Index: test/Lexer/has_feature_memory_sanitizer.cpp
===================================================================
--- test/Lexer/has_feature_memory_sanitizer.cpp
+++ 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
Index: lib/Lex/PPMacroExpansion.cpp
===================================================================
--- lib/Lex/PPMacroExpansion.cpp
+++ lib/Lex/PPMacroExpansion.cpp
@@ -780,6 +780,7 @@
            .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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D227.1.patch
Type: text/x-patch
Size: 1177 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121220/5542aeab/attachment.bin>


More information about the cfe-commits mailing list