Skip to content

[asan][windows][tests] support MSVC compiler-id in asan tests #109706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions compiler-rt/test/asan/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,16 @@ def build_invocation(compile_flags, with_lto=False):
if platform.system() == "Windows":
# MSVC-specific tests might also use the clang-cl.exe driver.
if target_is_msvc:
clang_cl_cxxflags = [
"-Wno-deprecated-declarations",
"-WX",
"-D_HAS_EXCEPTIONS=0",
"-Zi",
] + target_cflags
clang_cl_cxxflags = (
[
"-WX",
"-D_HAS_EXCEPTIONS=0",
]
+ config.debug_info_flags
+ target_cflags
)
if config.compiler_id != "MSVC":
clang_cl_cxxflags = ["-Wno-deprecated-declarations"] + clang_cl_cxxflags
clang_cl_asan_cxxflags = ["-fsanitize=address"] + clang_cl_cxxflags
if config.asan_dynamic:
clang_cl_asan_cxxflags.append("-MD")
Expand Down Expand Up @@ -286,6 +290,12 @@ def build_invocation(compile_flags, with_lto=False):
[config.compiler_rt_libdir, os.environ.get("PATH", "")]
)

# msvc needs to be instructed where the compiler-rt libraries are
if config.compiler_id == "MSVC":
config.environment["LIB"] = os.path.pathsep.join(
[config.compiler_rt_libdir, config.environment.get("LIB", "")]
)

# Default test suffixes.
config.suffixes = [".c", ".cpp"]

Expand Down
Loading