]> granicus.if.org Git - llvm/commitdiff
[libFuzzer] Remove optimization flags for tests.
authorMarcos Pividori <mpividori@google.com>
Sun, 22 Jan 2017 01:27:42 +0000 (01:27 +0000)
committerMarcos Pividori <mpividori@google.com>
Sun, 22 Jan 2017 01:27:42 +0000 (01:27 +0000)
We need to build all the tests with -O0, otherwise optimizations may merge some
basic blocks and the tests will fail.
In this diff, I simplify the cmake implementation and I remove the flags for
Windows too (/O[123s]).

Differential Revision: https://reviews.llvm.org/D28632

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292737 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Fuzzer/test/CMakeLists.txt

index 972dcec74aa52f14d5867e360b3952a5cdbaa385..0e7842f1beaf0ccd5c23616c175d149f9562f1b0 100644 (file)
@@ -11,17 +11,7 @@ set(variables_to_filter
   LIBFUZZER_FLAGS_BASE
   )
 foreach (VARNAME ${variables_to_filter})
-  string(REPLACE " " ";" BUILD_FLAGS_AS_LIST "${${VARNAME}}")
-  set(new_flags "")
-  foreach (flag ${BUILD_FLAGS_AS_LIST})
-    # NOTE: Use of XX here is to avoid a CMake warning due to CMP0054
-    if (NOT ("XX${flag}" MATCHES "XX-O[0123s]"))
-      set(new_flags "${new_flags} ${flag}")
-    else()
-      set(new_flags "${new_flags} -O0")
-    endif()
-  endforeach()
-  set(${VARNAME} "${new_flags}")
+  string(REGEX REPLACE "([-/]O)[123s]" "\\10" ${VARNAME} "${${VARNAME}}")
 endforeach()
 
 # Enable the coverage instrumentation (it is disabled for the Fuzzer lib).