Skip to content

Commit

Permalink
support clang-cl asan
Browse files Browse the repository at this point in the history
  • Loading branch information
actboy168 committed Apr 27, 2024
1 parent eb6eca5 commit 4ac8961
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion scripts/env/find_msvc.lua
Expand Up @@ -257,6 +257,14 @@ local function ucrtpath(arch, optimize)
return redist
end

local function llvmpath()
local path = installpath().."/VC/Tools/Llvm/x64/lib/clang/"
for p in fs.pairs(path) do
local version = p:filename():string()
return path .. version .."/lib/windows/"
end
end

return {
installpath = installpath,
toolspath = toolspath,
Expand All @@ -265,5 +273,6 @@ return {
binpath = binpath,
vcrtpath = vcrtpath,
ucrtpath = ucrtpath,
findwinsdk = findwinsdk
findwinsdk = findwinsdk,
llvmpath = llvmpath,
}
1 change: 1 addition & 0 deletions scripts/env/msvc.lua
Expand Up @@ -106,5 +106,6 @@ end
m.binpath = find_msvc.binpath
m.vcrtpath = find_msvc.vcrtpath
m.ucrtpath = find_msvc.ucrtpath
m.llvmpath = find_msvc.llvmpath

return m
4 changes: 3 additions & 1 deletion scripts/writer.lua
Expand Up @@ -707,10 +707,12 @@ function GEN.msvc_copydll(attribute, name)
end
end
elseif attribute.type == "asan" then
local inputdir = msvc.binpath(archalias)
local filename = ("clang_rt.asan_dynamic-%s.dll"):format(
attribute.arch == "x86_64" and "x86_64" or "i386"
)
local inputdir = globals.cc == "clang-cl"
and msvc.llvmpath()
or msvc.binpath(archalias)
for _, outputdir in ipairs(attributeOutputs) do
inputs[#inputs+1] = fsutil.join(inputdir, filename)
outputs[#outputs+1] = fsutil.join(outputdir, filename)
Expand Down

0 comments on commit 4ac8961

Please sign in to comment.