[libcxx] r219987 - [libcxx] Add support for LLVM_USE_SANITIZER=Undefined

Eric Fiselier eric at efcs.ca
Thu Oct 16 16:21:59 PDT 2014


Author: ericwf
Date: Thu Oct 16 18:21:59 2014
New Revision: 219987

URL: http://llvm.org/viewvc/llvm-project?rev=219987&view=rev
Log:
[libcxx] Add support for LLVM_USE_SANITIZER=Undefined

LLVM_USE_SANITIZER=Undefined support was added to the LLVM CMake configuration.
Update libc++'s handling of LLVM_USE_SANITIZER to support this as well.

Modified:
    libcxx/trunk/CMakeLists.txt
    libcxx/trunk/test/lit.cfg

Modified: libcxx/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=219987&r1=219986&r2=219987&view=diff
==============================================================================
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Thu Oct 16 18:21:59 2014
@@ -304,6 +304,9 @@ if (LIBCXX_BUILT_STANDALONE)
       if (LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins")
         list(APPEND LIBCXX_CXX_FEATURE_FLAGS "-fsanitize-memory-track-origins")
       endif()
+    elseif (LLVM_USE_SANITIZER STREQUAL "Undefined")
+      list(APPEND LIBCXX_CXX_FEATURE_FLAGS
+          "-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover")
     else()
       message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
     endif()

Modified: libcxx/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.cfg?rev=219987&r1=219986&r2=219987&view=diff
==============================================================================
--- libcxx/trunk/test/lit.cfg (original)
+++ libcxx/trunk/test/lit.cfg Thu Oct 16 18:21:59 2014
@@ -434,6 +434,11 @@ class Configuration(object):
                 if san == 'MemoryWithOrigins':
                     self.compile_flags += ['-fsanitize-memory-track-origins']
                 self.config.available_features.add('msan')
+            elif san == 'Undefined':
+                self.compile_flags += ['-fsanitize=undefined',
+                                       '-fno-sanitize=vptr,function',
+                                       '-fno-sanitize-recover']
+                self.config.available_features.add('ubsan')
             else:
                 self.lit_config.fatal('unsupported value for '
                                       'libcxx_use_san: {0}'.format(san))





More information about the cfe-commits mailing list