From 61624565e43d02a5271f74935cacc98a1953d645 Mon Sep 17 00:00:00 2001 From: c Date: Wed, 5 Jun 2024 22:41:42 -0700 Subject: [PATCH] Revert LLVM to 15 Partial revert of https://github.com/mono/CppSharp/pull/1724 to rule out C++17 as the cause of type issues --- CppSharp.CppParser/CppParser.cpp | 4 ++-- CppSharp.CppParser/Link.cpp | 7 +------ CppSharp.CppParser/Parser.cpp | 16 +++++++++------- CppSharp.CppParser/meson.build | 18 +++++++++--------- CppSharp.Parser.Bootstrap/Bootstrap.cs | 2 +- llvm/build-llvm.sh | 3 +++ submodules/llvm-project | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/CppSharp.CppParser/CppParser.cpp b/CppSharp.CppParser/CppParser.cpp index d6c1f7b36..62b37a567 100644 --- a/CppSharp.CppParser/CppParser.cpp +++ b/CppSharp.CppParser/CppParser.cpp @@ -7,7 +7,7 @@ #include "CppParser.h" #include "Parser.h" -#include +// #include #include namespace CppSharp { namespace CppParser { @@ -86,4 +86,4 @@ ParserDiagnostic::ParserDiagnostic(const ParserDiagnostic& rhs) ParserDiagnostic::~ParserDiagnostic() {} -} } \ No newline at end of file +} } diff --git a/CppSharp.CppParser/Link.cpp b/CppSharp.CppParser/Link.cpp index 46d066218..750e0804b 100644 --- a/CppSharp.CppParser/Link.cpp +++ b/CppSharp.CppParser/Link.cpp @@ -11,11 +11,6 @@ #include #include -LLD_HAS_DRIVER(coff) -LLD_HAS_DRIVER(elf) -LLD_HAS_DRIVER(mingw) -LLD_HAS_DRIVER(macho) - using namespace CppSharp::CppParser; bool Parser::Link(const std::string& File, const CppLinkerOptions* LinkerOptions) @@ -191,4 +186,4 @@ bool Parser::LinkMachO(const CppLinkerOptions* LinkerOptions, #else return false; #endif -} \ No newline at end of file +} diff --git a/CppSharp.CppParser/Parser.cpp b/CppSharp.CppParser/Parser.cpp index b4cd29abe..64a14ee9e 100644 --- a/CppSharp.CppParser/Parser.cpp +++ b/CppSharp.CppParser/Parser.cpp @@ -13,7 +13,7 @@ #include "ELFDumper.h" #include "APValuePrinter.h" -#include +// #include #include #include #include @@ -2609,7 +2609,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, { auto TO = Type->getAs(); - Ty = WalkType(TO->getUnmodifiedType()); + Ty = WalkType(TO->getUnderlyingType()); break; } case clang::Type::TypeOfExpr: @@ -2782,9 +2782,9 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, auto RepTy = TP->getReplacementType(); TPT->replacement = GetQualifiedType(RepTy, &Next); TPT->replacedParameter = (TemplateParameterType*) - WalkType(c->getASTContext().getTypeDeclType(TP->getReplacedParameter()), 0); + WalkType(clang::QualType(TP->getReplacedParameter(), 0), 0); TPT->replacedParameter->parameter = WalkTypeTemplateParameter( - TP->getReplacedParameter()); + TP->getReplacedParameter()->getDecl()); Ty = TPT; break; @@ -4408,7 +4408,9 @@ bool Parser::SetupSourceFiles(const std::vector& SourceFiles, { // Check that the file is reachable. clang::ConstSearchDirIterator *Dir = 0; - llvm::ArrayRef> Includers; + llvm::SmallVector< + std::pair, + 0> Includers; for (const auto& SourceFile : SourceFiles) { @@ -4927,8 +4929,8 @@ ParserTargetInfo* Parser::GetTargetInfo() parserTargetInfo->longDoubleWidth = TI.getLongDoubleWidth(); parserTargetInfo->longLongAlign = TI.getLongLongAlign(); parserTargetInfo->longLongWidth = TI.getLongLongWidth(); - parserTargetInfo->pointerAlign = TI.getPointerAlign(clang::LangAS::Default); - parserTargetInfo->pointerWidth = TI.getPointerWidth(clang::LangAS::Default); + parserTargetInfo->pointerAlign = TI.getPointerAlign(0); + parserTargetInfo->pointerWidth = TI.getPointerWidth(0); parserTargetInfo->wCharAlign = TI.getWCharAlign(); parserTargetInfo->wCharWidth = TI.getWCharWidth(); parserTargetInfo->float128Align = TI.getFloat128Align(); diff --git a/CppSharp.CppParser/meson.build b/CppSharp.CppParser/meson.build index dd6ef391f..7942830c4 100644 --- a/CppSharp.CppParser/meson.build +++ b/CppSharp.CppParser/meson.build @@ -66,7 +66,7 @@ llvm_link_libraries = [ cpp.find_library('clangToolingASTDiff', dirs : [ llvm_lib_path ]), cpp.find_library('clangToolingCore', dirs : [ llvm_lib_path ]), cpp.find_library('clangToolingInclusions', dirs : [ llvm_lib_path ]), - cpp.find_library('clangToolingInclusionsStdlib', dirs : [ llvm_lib_path ]), + # cpp.find_library('clangToolingInclusionsStdlib', dirs : [ llvm_lib_path ]), cpp.find_library('clangToolingRefactoring', dirs : [ llvm_lib_path ]), cpp.find_library('clangToolingSyntax', dirs : [ llvm_lib_path ]), cpp.find_library('clangTransformer', dirs : [ llvm_lib_path ]), @@ -81,30 +81,30 @@ llvm_link_libraries = [ cpp.find_library('LLVMCFGuard', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMCFIVerify', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMCodeGen', dirs : [ llvm_lib_path ]), - cpp.find_library('LLVMCodeGenTypes', dirs : [ llvm_lib_path ]), + # cpp.find_library('LLVMCodeGenTypes', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMCore', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMCoroutines', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMCoverage', dirs : [ llvm_lib_path ]), - cpp.find_library('LLVMDebugInfoBTF', dirs : [ llvm_lib_path ]), + # cpp.find_library('LLVMDebugInfoBTF', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMDebugInfoCodeView', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMDebuginfod', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMDebugInfoDWARF', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMDebugInfoGSYM', dirs : [ llvm_lib_path ]), - cpp.find_library('LLVMDebugInfoLogicalView', dirs : [ llvm_lib_path ]), + # cpp.find_library('LLVMDebugInfoLogicalView', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMDebugInfoMSF', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMDebugInfoPDB', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMDemangle', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMDiff', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMDlltoolDriver', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMDWARFLinker', dirs : [ llvm_lib_path ]), - cpp.find_library('LLVMDWARFLinkerParallel', dirs : [ llvm_lib_path ]), + # cpp.find_library('LLVMDWARFLinkerParallel', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMDWP', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMExecutionEngine', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMExegesis', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMExegesisX86', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMExtensions', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMFileCheck', dirs : [ llvm_lib_path ]), - cpp.find_library('LLVMFrontendHLSL', dirs : [ llvm_lib_path ]), + # cpp.find_library('LLVMFrontendHLSL', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMFrontendOpenACC', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMFrontendOpenMP', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMFuzzerCLI', dirs : [ llvm_lib_path ]), @@ -115,7 +115,7 @@ llvm_link_libraries = [ cpp.find_library('LLVMInterfaceStub', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMInterpreter', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMipo', dirs : [ llvm_lib_path ]), - cpp.find_library('LLVMIRPrinter', dirs : [ llvm_lib_path ]), + # cpp.find_library('LLVMIRPrinter', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMIRReader', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMJITLink', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMLibDriver', dirs : [ llvm_lib_path ]), @@ -145,10 +145,10 @@ llvm_link_libraries = [ cpp.find_library('LLVMSupport', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMSymbolize', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMTableGen', dirs : [ llvm_lib_path ]), - cpp.find_library('LLVMTableGenCommon', dirs : [ llvm_lib_path ]), + # cpp.find_library('LLVMTableGenCommon', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMTableGenGlobalISel', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMTarget', dirs : [ llvm_lib_path ]), - cpp.find_library('LLVMTargetParser', dirs : [ llvm_lib_path ]), + # cpp.find_library('LLVMTargetParser', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMTextAPI', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMTransformUtils', dirs : [ llvm_lib_path ]), cpp.find_library('LLVMVectorize', dirs : [ llvm_lib_path ]), diff --git a/CppSharp.Parser.Bootstrap/Bootstrap.cs b/CppSharp.Parser.Bootstrap/Bootstrap.cs index da864c60a..ea6639d55 100644 --- a/CppSharp.Parser.Bootstrap/Bootstrap.cs +++ b/CppSharp.Parser.Bootstrap/Bootstrap.cs @@ -36,7 +36,7 @@ public void Setup(Driver driver) driver.ParserOptions.EnableRTTI = true; driver.ParserOptions.SkipLayoutInfo = true; driver.ParserOptions.UnityBuild = true; - driver.ParserOptions.LanguageVersion = CppSharp.Parser.LanguageVersion.CPP17; + // driver.ParserOptions.LanguageVersion = CppSharp.Parser.LanguageVersion.CPP17; var module = driver.Options.AddModule("CppSharp"); diff --git a/llvm/build-llvm.sh b/llvm/build-llvm.sh index 31ab03409..41f97d4a5 100755 --- a/llvm/build-llvm.sh +++ b/llvm/build-llvm.sh @@ -47,3 +47,6 @@ popd rm -rf $clang_resource_headers_dest/lib mkdir -p $clang_resource_headers_dest/lib/clang cp -r $llvm_install_dir/lib/clang $clang_resource_headers_dest/lib + +# TODO: ?? +mv $clang_resource_headers_dest/lib/15.0.7 $clang_resource_headers_dest/lib/15 diff --git a/submodules/llvm-project b/submodules/llvm-project index 6009708b4..8dfdcc7b7 160000 --- a/submodules/llvm-project +++ b/submodules/llvm-project @@ -1 +1 @@ -Subproject commit 6009708b4367171ccdbf4b5905cb6a803753fe18 +Subproject commit 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a