1# -*- Python -*-
2
3import os
4
5# Setup config name.
6config.name = 'DataFlowSanitizer' + config.name_suffix
7
8# Setup source root.
9config.test_source_root = os.path.dirname(__file__)
10
11# Setup default compiler flags used with -fsanitize=dataflow option.
12clang_dfsan_cflags = ["-fsanitize=dataflow", config.target_cflags]
13clang_dfsan_cxxflags = config.cxx_mode_flags + clang_dfsan_cflags
14
15def build_invocation(compile_flags):
16  return " " + " ".join([config.clang] + compile_flags) + " "
17
18config.substitutions.append( ("%clang_dfsan ", build_invocation(clang_dfsan_cflags)) )
19config.substitutions.append( ("%clangxx_dfsan ", build_invocation(clang_dfsan_cxxflags)) )
20
21# Default test suffixes.
22config.suffixes = ['.c', '.cpp']
23
24# DataFlowSanitizer tests are currently supported on Linux only.
25if config.host_os not in ['Linux']:
26  config.unsupported = True
27