Skip to content

Commit

Permalink
Revert LLVM to 15
Browse files Browse the repository at this point in the history
Partial revert of mono#1724 to rule out C++17
as the cause of type issues
  • Loading branch information
c committed Jun 6, 2024
1 parent 58cf7f5 commit 6162456
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions CppSharp.CppParser/CppParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "CppParser.h"
#include "Parser.h"
#include <llvm/TargetParser/Host.h>
// #include <llvm/TargetParser/Host.h>
#include <clang/Basic/Version.inc>

namespace CppSharp { namespace CppParser {
Expand Down Expand Up @@ -86,4 +86,4 @@ ParserDiagnostic::ParserDiagnostic(const ParserDiagnostic& rhs)

ParserDiagnostic::~ParserDiagnostic() {}

} }
} }
7 changes: 1 addition & 6 deletions CppSharp.CppParser/Link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
#include <Driver/ToolChains/Linux.h>
#include <lld/Common/Driver.h>

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)
Expand Down Expand Up @@ -191,4 +186,4 @@ bool Parser::LinkMachO(const CppLinkerOptions* LinkerOptions,
#else
return false;
#endif
}
}
16 changes: 9 additions & 7 deletions CppSharp.CppParser/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "ELFDumper.h"
#include "APValuePrinter.h"

#include <llvm/TargetParser/Host.h>
// #include <llvm/TargetParser/Host.h>
#include <llvm/Support/Path.h>
#include <llvm/Support/raw_ostream.h>
#include <llvm/Support/TargetSelect.h>
Expand Down Expand Up @@ -2609,7 +2609,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
{
auto TO = Type->getAs<clang::TypeOfType>();

Ty = WalkType(TO->getUnmodifiedType());
Ty = WalkType(TO->getUnderlyingType());
break;
}
case clang::Type::TypeOfExpr:
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -4408,7 +4408,9 @@ bool Parser::SetupSourceFiles(const std::vector<std::string>& SourceFiles,
{
// Check that the file is reachable.
clang::ConstSearchDirIterator *Dir = 0;
llvm::ArrayRef<std::pair<const clang::FileEntry*, clang::DirectoryEntryRef>> Includers;
llvm::SmallVector<
std::pair<const clang::FileEntry *, const clang::DirectoryEntry *>,
0> Includers;

for (const auto& SourceFile : SourceFiles)
{
Expand Down Expand Up @@ -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();
Expand Down
18 changes: 9 additions & 9 deletions CppSharp.CppParser/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]),
Expand All @@ -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 ]),
Expand All @@ -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 ]),
Expand Down Expand Up @@ -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 ]),
Expand Down
2 changes: 1 addition & 1 deletion CppSharp.Parser.Bootstrap/Bootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
3 changes: 3 additions & 0 deletions llvm/build-llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion submodules/llvm-project

0 comments on commit 6162456

Please sign in to comment.