Skip to content

Commit

Permalink
[libFuzzer] Remove optimization flags for tests.
Browse files Browse the repository at this point in the history
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

llvm-svn: 292737
  • Loading branch information
Marcos Pividori committed Jan 22, 2017
1 parent 6137f98 commit 403007e
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions llvm/lib/Fuzzer/test/CMakeLists.txt
Expand Up @@ -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).
Expand Down

0 comments on commit 403007e

Please sign in to comment.