Browse Source

support clang 15.0.7

pull/1724/head
you74674 2 years ago committed by Joao Matos
parent
commit
65c0a347a7
  1. 2
      build/LLVM.lua
  2. 8
      build/build.sh
  3. 2
      build/llvm/LLVM-commit
  4. 2
      build/llvm/LLVM.lua
  5. 6
      src/Core/Toolchains/MSVCToolchain.cs
  6. 4
      src/CppParser/Link.cpp
  7. 2
      src/CppParser/ParseExpr.cpp
  8. 2
      src/CppParser/ParseStmt.cpp
  9. 4
      src/CppParser/Parser.cpp
  10. 3
      src/Parser/ParserOptions.cs

2
build/LLVM.lua

@ -144,12 +144,14 @@ function SetupLLVMLibs() @@ -144,12 +144,14 @@ function SetupLLVMLibs()
"clangCodeGen",
"clangParse",
"clangSema",
"clangSupport",
"clangAnalysis",
"clangEdit",
"clangAST",
"clangLex",
"clangBasic",
"clangIndex",
"LLVMWindowsDriver",
"LLVMWindowsManifest",
"LLVMDebugInfoPDB",
"LLVMLTO",

8
build/build.sh

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
set -e
builddir=$(cd "$(dirname "$0")"; pwd)
platform=x64
vs=vs2019
vs=vs2022
configuration=Release
build_only=false
ci=false
@ -111,11 +111,11 @@ download_premake() @@ -111,11 +111,11 @@ download_premake()
if ! [ -f "$premake_path" ]; then
echo "Downloading and unpacking Premake..."
premake_url=https://github.com/InteropAlliance/premake-core/releases/download/latest/premake-$oshost-$platform.zip
premake_url=https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-$oshost.zip
curl -L -O $premake_url
unzip premake-$oshost-$platform.zip $premake_filename -d "$premake_dir"
unzip premake-5.0.0-beta2-$oshost.zip $premake_filename -d "$premake_dir"
chmod +x "$premake_path"
rm premake-$oshost-$platform.zip
rm premake-5.0.0-beta2-$oshost.zip
fi
}

2
build/llvm/LLVM-commit

@ -1 +1 @@ @@ -1 +1 @@
791523bae6153b13bb41ba05c9fc89e502cc4a1a
8dfdcc7b7bf66834a761bd8de445840ef68e4d1a

2
build/llvm/LLVM.lua

@ -370,6 +370,8 @@ function cmake(gen, conf, builddir, options) @@ -370,6 +370,8 @@ function cmake(gen, conf, builddir, options)
.. ' -DCLANG_TOOL_CLANG_FUZZER_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_IMPORT_TEST_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_NVLINK_WRAPPER_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_LINKER_WRAPPER_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_OFFLOAD_PACKAGER_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_OFFLOAD_BUNDLER_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_OFFLOAD_WRAPPER_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_REFACTOR_BUILD=false'

6
src/Core/Toolchains/MSVCToolchain.cs

@ -16,6 +16,7 @@ namespace CppSharp @@ -16,6 +16,7 @@ namespace CppSharp
VS2015 = 14,
VS2017 = 15,
VS2019 = 16,
VS2022 = 17,
Latest,
}
@ -67,9 +68,12 @@ namespace CppSharp @@ -67,9 +68,12 @@ namespace CppSharp
clVersion = new Version { Major = 19, Minor = 10 };
break;
case VisualStudioVersion.VS2019:
case VisualStudioVersion.Latest:
clVersion = new Version { Major = 19, Minor = 20 };
break;
case VisualStudioVersion.VS2022:
case VisualStudioVersion.Latest:
clVersion = new Version { Major = 19, Minor = 30 };
break;
default:
throw new Exception("Unknown Visual Studio version");
}

4
src/CppParser/Link.cpp

@ -69,7 +69,7 @@ bool Parser::LinkWindows(const CppLinkerOptions* LinkerOptions, @@ -69,7 +69,7 @@ bool Parser::LinkWindows(const CppLinkerOptions* LinkerOptions,
std::vector<std::string> LibraryPaths;
LibraryPaths.push_back("-libpath:" + TC.getSubDirectoryPath(
clang::driver::toolchains::MSVCToolChain::SubDirectoryType::Lib));
llvm::SubDirectoryType::Lib));
std::string CRTPath;
if (TC.getUniversalCRTLibraryPath(Args, CRTPath))
LibraryPaths.push_back("-libpath:" + CRTPath);
@ -100,7 +100,7 @@ bool Parser::LinkWindows(const CppLinkerOptions* LinkerOptions, @@ -100,7 +100,7 @@ bool Parser::LinkWindows(const CppLinkerOptions* LinkerOptions,
std::string Out("-out:" + std::string(Output));
args.push_back(Out.data());
return lld::coff::link(args, false, outs(), errs());
return lld::coff::link(args, outs(), errs(), false, false);
#else
return false;
#endif

2
src/CppParser/ParseExpr.cpp

@ -223,7 +223,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr) @@ -223,7 +223,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
_S->length = S->getLength();
_S->charByteWidth = S->getCharByteWidth();
_S->kind = (StringLiteral::StringKind) S->getKind();
_S->isAscii = S->isAscii();
_S->isAscii = S->isOrdinary();
_S->isWide = S->isWide();
_S->isUTF8 = S->isUTF8();
_S->isUTF16 = S->isUTF16();

2
src/CppParser/ParseStmt.cpp

@ -356,7 +356,7 @@ AST::Stmt* Parser::WalkStatement(const clang::Stmt* Stmt) @@ -356,7 +356,7 @@ AST::Stmt* Parser::WalkStatement(const clang::Stmt* Stmt)
_S->allocate = static_cast<AST::Expr*>(WalkExpression(S->getAllocate()));
_S->deallocate = static_cast<AST::Expr*>(WalkExpression(S->getDeallocate()));
_S->returnValueInit = static_cast<AST::Expr*>(WalkExpression(S->getReturnValueInit()));
_S->resultDecl = static_cast<AST::Stmt*>(WalkStatement(S->getResultDecl()));
_S->resultDecl = static_cast<AST::Stmt*>(WalkStatement(S->getReturnValue()));
_S->returnStmt = static_cast<AST::Stmt*>(WalkStatement(S->getReturnStmt()));
_S->returnStmtOnAllocFailure = static_cast<AST::Stmt*>(WalkStatement(S->getReturnStmtOnAllocFailure()));
_Stmt = _S;

4
src/CppParser/Parser.cpp

@ -4386,7 +4386,7 @@ void Parser::SetupLLVMCodegen() @@ -4386,7 +4386,7 @@ void Parser::SetupLLVMCodegen()
LLVMModule->setTargetTriple(c->getTarget().getTriple().getTriple());
LLVMModule->setDataLayout(c->getTarget().getDataLayoutString());
CGM.reset(new clang::CodeGen::CodeGenModule(c->getASTContext(),
CGM.reset(new clang::CodeGen::CodeGenModule(c->getASTContext(), nullptr,
c->getHeaderSearchOpts(), c->getPreprocessorOpts(),
c->getCodeGenOpts(), *LLVMModule, c->getDiagnostics()));
@ -4397,7 +4397,7 @@ bool Parser::SetupSourceFiles(const std::vector<std::string>& SourceFiles, @@ -4397,7 +4397,7 @@ bool Parser::SetupSourceFiles(const std::vector<std::string>& SourceFiles,
std::vector<const clang::FileEntry*>& FileEntries)
{
// Check that the file is reachable.
const clang::DirectoryLookup *Dir;
clang::ConstSearchDirIterator *Dir;
llvm::SmallVector<
std::pair<const clang::FileEntry *, const clang::DirectoryEntry *>,
0> Includers;

3
src/Parser/ParserOptions.cs

@ -136,6 +136,9 @@ namespace CppSharp.Parser @@ -136,6 +136,9 @@ namespace CppSharp.Parser
case "vs2019":
vsVersion = VisualStudioVersion.VS2019;
break;
case "vs2022":
vsVersion = VisualStudioVersion.VS2022;
break;
#pragma warning restore 162

Loading…
Cancel
Save