Skip to content

Commit

Permalink
update llvm to 17.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
SaeruHikari committed Sep 20, 2023
1 parent 3113348 commit c7cd2f6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 30 deletions.
18 changes: 6 additions & 12 deletions setup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,18 @@ import("utils.archive")
import("download")

if (os.host() =="windows") then
local windows_llvm_version = "15.0.4"
-- windows llvm
local release_url = "SakuraEngine/llvm-package-windows/releases/download/llvm-"..windows_llvm_version.."/llvm-"..windows_llvm_version.."-windows-amd64-msvc17-msvcrt.7z"
local zipname = "llvm-"..windows_llvm_version.."-windows-amd64-msvc17-msvcrt.7z"
download.file_from_github(release_url, zipname)
archive.extract("SDKs/"..zipname, os.projectdir())

-- windows clang
local release_url = "SakuraEngine/llvm-package-windows/releases/download/llvm-"..windows_llvm_version.."/clang-"..windows_llvm_version.."-windows-amd64-msvc17-msvcrt.7z"
local zipname = "clang-"..windows_llvm_version.."-windows-amd64-msvc17-msvcrt.7z"
local windows_llvm_version = "17.0.1"
-- windows llvm https://github.com/SakuraEngine/llvm-build/releases/download/llvm-17.0.1/llvm-17.0.1-msvc17-x64-md-release.7z
local release_url = "SakuraEngine/llvm-build/releases/download/llvm-"..windows_llvm_version.."/llvm-"..windows_llvm_version.."-msvc17-x64-md-release.7z"
local zipname = "llvm-"..windows_llvm_version.."-msvc17-x64-md-release.7z"
download.file_from_github(release_url, zipname)
archive.extract("SDKs/"..zipname, os.projectdir())
end

-- macos llvm & clang
if (os.host() =="macosx") then
local release_url = "llvm/llvm-project/releases/download/llvmorg-15.0.1/clang+llvm-15.0.1-x86_64-apple-darwin.tar.xz"
local zipname = "clang+llvm-15.0.1-x86_64-apple-darwin.tar.xz"
local release_url = "llvm/llvm-project/releases/download/llvmorg-17.0.1/clang+llvm-17.0.1-x86_64-apple-darwin.tar.xz"
local zipname = "clang+llvm-17.0.1-x86_64-apple-darwin.tar.xz"
download.file_from_github(release_url, zipname)
archive.extract("SDKs/"..zipname, os.projectdir())
end
17 changes: 10 additions & 7 deletions src/ASTConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,18 @@ void meta::ASTConsumer::HandleFunctionPointer(clang::DeclaratorDecl* decl, meta:
trueDecl = TDT->getDecl();
Ty = TDT->getDecl()->getUnderlyingType();
}
const clang::TemplateSpecializationType *TST = Ty->getAs<clang::TemplateSpecializationType>();
bool isFunctor = false;
if(TST && TST->getNumArgs() != 0)
if(auto TST = Ty->getAs<clang::TemplateSpecializationType>())
{
//is first arg a function pointer?
if(TST->getArg(0).getKind() != clang::TemplateArgument::Type)
return;
Ty = TST->getArg(0).getAsType();
isFunctor = true;
auto Arguments = TST->template_arguments();
if (Arguments.size() != 0)
{
//is first arg a function pointer?
if(Arguments[0].getKind() != clang::TemplateArgument::Type)
return;
Ty = Arguments[0].getAsType();
isFunctor = true;
}
}
TDT = Ty->getAs<TypedefType>();
if(TDT)
Expand Down
18 changes: 7 additions & 11 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ set_languages("c11", "cxx17")

if (is_os("windows")) then

local windows_llvm_version = "15.0.4"
local windows_llvm_version = "17.0.1"
target("meta")
set_runtimes("MD")
set_kind("binary")
add_files("src/**.cpp")
add_cxflags("-Wno-c++11-narrowing")
add_cxflags("-fno-rtti")
add_cxflags("clang::-Wno-c++11-narrowing", "-fno-rtti", {force = true})
add_links("lib/**")
add_links("Version", "advapi32", "Shcore", "user32", "shell32", "Ole32", {public = true})
-- llvm & clang
add_linkdirs("llvm-"..windows_llvm_version.."-windows-amd64-msvc17-msvcrt/lib")
add_linkdirs("clang-"..windows_llvm_version.."-windows-amd64-msvc17-msvcrt/lib")
on_load(function (target, opt)
local libs = {}
local p = "llvm-"..windows_llvm_version.."-windows-amd64-msvc17-msvcrt/lib/*.lib"
Expand All @@ -30,8 +27,7 @@ target("meta")
end
target:add("links", libs)
end)
add_includedirs("llvm-"..windows_llvm_version.."-windows-amd64-msvc17-msvcrt/include")
add_includedirs("clang-"..windows_llvm_version.."-windows-amd64-msvc17-msvcrt/include")
add_includedirs("include")
else

target("meta")
Expand All @@ -40,23 +36,23 @@ target("meta")
add_cxflags("-Wno-c++11-narrowing")
add_cxflags("-fno-rtti")
add_syslinks("pthread", "curses")
add_linkdirs("clang+llvm-15.0.1-x86_64-apple-darwin/lib")
add_linkdirs("clang+llvm-17.0.1-x86_64-apple-darwin/lib")
on_load(function (target, opt)
local libs = {}
local p = "clang+llvm-15.0.1-x86_64-apple-darwin/lib/libLLVM*.a"
local p = "clang+llvm-17.0.1-x86_64-apple-darwin/lib/libLLVM*.a"
for __, filepath in ipairs(os.files(p)) do
local basename = path.basename(filepath)
local matchname = string.match(basename, "lib(.*)$")
table.insert(libs, matchname or basename)
end
local p2 = "clang+llvm-15.0.1-x86_64-apple-darwin/lib/libclang*.a"
local p2 = "clang+llvm-17.0.1-x86_64-apple-darwin/lib/libclang*.a"
for __, filepath in ipairs(os.files(p2)) do
local basename = path.basename(filepath)
local matchname = string.match(basename, "lib(.*)$")
table.insert(libs, matchname or basename)
end
target:add("links", libs)
end)
add_includedirs("clang+llvm-15.0.1-x86_64-apple-darwin/include")
add_includedirs("clang+llvm-17.0.1-x86_64-apple-darwin/include")

end

0 comments on commit c7cd2f6

Please sign in to comment.