Browse Source

More build fixes.

pull/1724/head
Joao Matos 2 years ago
parent
commit
78ad409bb5
  1. 2
      .github/workflows/llvm-win.yml
  2. 1
      .github/workflows/main.yml
  3. 1
      Directory.Build.props
  4. 11
      build/LLVM.lua
  5. 4
      build/llvm/LLVM.lua
  6. 2
      src/CppParser/CppParser.cpp
  7. 5
      src/CppParser/Link.cpp
  8. 12
      src/CppParser/ParseExpr.cpp
  9. 32
      src/CppParser/Parser.cpp
  10. 4
      src/CppParser/premake5.lua
  11. 1
      src/Generator/Generators/CSharp/CSharpCommentPrinter.cs
  12. 13
      src/Parser/ParserOptions.cs

2
.github/workflows/llvm-win.yml

@ -9,8 +9,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
config: config:
- { os: windows-2019, platform: x86, vs: "Program Files (x86)/Microsoft Visual Studio/2019" }
- { os: windows-2019, platform: x64, vs: "Program Files (x86)/Microsoft Visual Studio/2019" }
- { os: windows-2022, platform: x86, vs: "Program Files/Microsoft Visual Studio/2022" } - { os: windows-2022, platform: x86, vs: "Program Files/Microsoft Visual Studio/2022" }
- { os: windows-2022, platform: x64, vs: "Program Files/Microsoft Visual Studio/2022" } - { os: windows-2022, platform: x64, vs: "Program Files/Microsoft Visual Studio/2022" }

1
.github/workflows/main.yml

@ -11,7 +11,6 @@ jobs:
config: config:
- { os: ubuntu-22.04, platform: x64, cxx: g++-11, cc: gcc-11 } - { os: ubuntu-22.04, platform: x64, cxx: g++-11, cc: gcc-11 }
- { os: macos-11, platform: x64, cxx: clang++, cc: clang } - { os: macos-11, platform: x64, cxx: clang++, cc: clang }
- { os: windows-2019, platform: x64, vs: "Program Files (x86)/Microsoft Visual Studio/2019" }
- { os: windows-2022, platform: x64, vs: "Program Files/Microsoft Visual Studio/2022" } - { os: windows-2022, platform: x64, vs: "Program Files/Microsoft Visual Studio/2022" }
runs-on: ${{ matrix.config.os }} runs-on: ${{ matrix.config.os }}

1
Directory.Build.props

@ -52,7 +52,6 @@
</PropertyGroup> </PropertyGroup>
<Target Name="prepack" DependsOnTargets="Build" Condition="'$(IsPackable)' == 'true' AND '$(Platform)' == 'x64'"> <Target Name="prepack" DependsOnTargets="Build" Condition="'$(IsPackable)' == 'true' AND '$(Platform)' == 'x64'">
<Copy SourceFiles="$(TargetDir)ref\$(TargetFileName)" DestinationFolder="$(PackageDir)ref\$(GlobalTargetFramework)" Condition="'$(ProduceReferenceAssembly)' == 'true' AND '$(RID)' == 'win-x64'" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(PackageDir)runtimes\$(RID)\lib\$(GlobalTargetFramework)" /> <Copy SourceFiles="$(TargetPath)" DestinationFolder="$(PackageDir)runtimes\$(RID)\lib\$(GlobalTargetFramework)" />
</Target> </Target>
</Project> </Project>

11
build/LLVM.lua

@ -42,6 +42,7 @@ function SetupLLVMIncludes()
includedirs includedirs
{ {
path.join(LLVMRootDirDebug, "include"), path.join(LLVMRootDirDebug, "include"),
path.join(LLVMRootDirDebug, "llvm/include"),
path.join(LLVMRootDirDebug, "lld/include"), path.join(LLVMRootDirDebug, "lld/include"),
path.join(LLVMRootDirDebug, "clang/include"), path.join(LLVMRootDirDebug, "clang/include"),
path.join(LLVMRootDirDebug, "clang/lib"), path.join(LLVMRootDirDebug, "clang/lib"),
@ -53,6 +54,7 @@ function SetupLLVMIncludes()
includedirs includedirs
{ {
path.join(LLVMRootDirRelease, "include"), path.join(LLVMRootDirRelease, "include"),
path.join(LLVMRootDirRelease, "llvm/include"),
path.join(LLVMRootDirRelease, "lld/include"), path.join(LLVMRootDirRelease, "lld/include"),
path.join(LLVMRootDirRelease, "clang/include"), path.join(LLVMRootDirRelease, "clang/include"),
path.join(LLVMRootDirRelease, "clang/lib"), path.join(LLVMRootDirRelease, "clang/lib"),
@ -64,6 +66,7 @@ function SetupLLVMIncludes()
includedirs includedirs
{ {
path.join(LLVMRootDir, "include"), path.join(LLVMRootDir, "include"),
path.join(LLVMRootDir, "llvm/include"),
path.join(LLVMRootDir, "lld/include"), path.join(LLVMRootDir, "lld/include"),
path.join(LLVMRootDir, "clang/include"), path.join(LLVMRootDir, "clang/include"),
path.join(LLVMRootDir, "clang/lib"), path.join(LLVMRootDir, "clang/lib"),
@ -151,6 +154,7 @@ function SetupLLVMLibs()
"clangLex", "clangLex",
"clangBasic", "clangBasic",
"clangIndex", "clangIndex",
"clangASTMatchers",
"LLVMWindowsDriver", "LLVMWindowsDriver",
"LLVMWindowsManifest", "LLVMWindowsManifest",
"LLVMDebugInfoPDB", "LLVMDebugInfoPDB",
@ -158,6 +162,7 @@ function SetupLLVMLibs()
"LLVMPasses", "LLVMPasses",
"LLVMObjCARCOpts", "LLVMObjCARCOpts",
"LLVMLibDriver", "LLVMLibDriver",
"LLVMFrontendHLSL",
"LLVMFrontendOpenMP", "LLVMFrontendOpenMP",
"LLVMOption", "LLVMOption",
"LLVMCoverage", "LLVMCoverage",
@ -172,6 +177,7 @@ function SetupLLVMLibs()
"LLVMVectorize", "LLVMVectorize",
"LLVMLinker", "LLVMLinker",
"LLVMIRReader", "LLVMIRReader",
"LLVMIRPrinter",
"LLVMAsmParser", "LLVMAsmParser",
"LLVMMCDisassembler", "LLVMMCDisassembler",
"LLVMCFGuard", "LLVMCFGuard",
@ -180,7 +186,9 @@ function SetupLLVMLibs()
"LLVMAsmPrinter", "LLVMAsmPrinter",
"LLVMDebugInfoDWARF", "LLVMDebugInfoDWARF",
"LLVMCodeGen", "LLVMCodeGen",
"LLVMCodeGenTypes",
"LLVMTarget", "LLVMTarget",
"LLVMTargetParser",
"LLVMScalarOpts", "LLVMScalarOpts",
"LLVMInstCombine", "LLVMInstCombine",
"LLVMAggressiveInstCombine", "LLVMAggressiveInstCombine",
@ -204,7 +212,8 @@ function SetupLLVMLibs()
"lldCommon", "lldCommon",
"lldCOFF", "lldCOFF",
"lldELF", "lldELF",
"lldMachO" "lldMachO",
"lldMinGW"
} }
filter(c) filter(c)

4
build/llvm/LLVM.lua

@ -459,7 +459,7 @@ function package_llvm(conf, llvm_base, llvm_build)
if os.isdir(out) then os.rmdir(out) end if os.isdir(out) then os.rmdir(out) end
os.mkdir(out) os.mkdir(out)
os.copydir(llvm_base .. "/llvm/include", out .. "/include") os.copydir(llvm_base .. "/llvm/include", out .. "/llvm/include")
os.copydir(llvm_base .. "/lld/include", out .. "/lld/include") os.copydir(llvm_base .. "/lld/include", out .. "/lld/include")
os.copydir(llvm_build .. "/include", out .. "/build/include") os.copydir(llvm_build .. "/include", out .. "/build/include")
@ -486,12 +486,10 @@ function package_llvm(conf, llvm_base, llvm_build)
local out_lib_dir = out .. "/build/lib" local out_lib_dir = out .. "/build/lib"
if os.ishost("windows") then if os.ishost("windows") then
os.rmfiles(out_lib_dir, "clang*ARC*.lib") os.rmfiles(out_lib_dir, "clang*ARC*.lib")
os.rmfiles(out_lib_dir, "clang*Matchers*.lib")
os.rmfiles(out_lib_dir, "clang*Rewrite*.lib") os.rmfiles(out_lib_dir, "clang*Rewrite*.lib")
os.rmfiles(out_lib_dir, "clang*StaticAnalyzer*.lib") os.rmfiles(out_lib_dir, "clang*StaticAnalyzer*.lib")
else else
os.rmfiles(out_lib_dir, "libclang*ARC*.a") os.rmfiles(out_lib_dir, "libclang*ARC*.a")
os.rmfiles(out_lib_dir, "libclang*Matchers*.a")
os.rmfiles(out_lib_dir, "libclang*Rewrite*.a") os.rmfiles(out_lib_dir, "libclang*Rewrite*.a")
os.rmfiles(out_lib_dir, "libclang*StaticAnalyzer*.a") os.rmfiles(out_lib_dir, "libclang*StaticAnalyzer*.a")
end end

2
src/CppParser/CppParser.cpp

@ -7,7 +7,7 @@
#include "CppParser.h" #include "CppParser.h"
#include "Parser.h" #include "Parser.h"
#include <llvm/Support/Host.h> #include <llvm/TargetParser/Host.h>
#include <clang/Basic/Version.inc> #include <clang/Basic/Version.inc>
namespace CppSharp { namespace CppParser { namespace CppSharp { namespace CppParser {

5
src/CppParser/Link.cpp

@ -11,6 +11,11 @@
#include <Driver/ToolChains/Linux.h> #include <Driver/ToolChains/Linux.h>
#include <lld/Common/Driver.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; using namespace CppSharp::CppParser;
bool Parser::Link(const std::string& File, const CppLinkerOptions* LinkerOptions) bool Parser::Link(const std::string& File, const CppLinkerOptions* LinkerOptions)

12
src/CppParser/ParseExpr.cpp

@ -400,7 +400,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
_S->calleeDecl = static_cast<AST::Declaration*>(WalkDeclaration(S->getCalleeDecl())); _S->calleeDecl = static_cast<AST::Declaration*>(WalkDeclaration(S->getCalleeDecl()));
_S->directCallee = static_cast<AST::Function*>(WalkDeclaration(S->getDirectCallee())); _S->directCallee = static_cast<AST::Function*>(WalkDeclaration(S->getDirectCallee()));
_S->numArgs = S->getNumArgs(); _S->numArgs = S->getNumArgs();
_S->numCommas = S->getNumCommas(); _S->numCommas = 0; // Removed from Clang
_S->builtinCallee = S->getBuiltinCallee(); _S->builtinCallee = S->getBuiltinCallee();
_S->isCallToStdMove = S->isCallToStdMove(); _S->isCallToStdMove = S->isCallToStdMove();
for (auto _E : S->arguments()) for (auto _E : S->arguments())
@ -1172,7 +1172,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
_S->calleeDecl = static_cast<AST::Declaration*>(WalkDeclaration(S->getCalleeDecl())); _S->calleeDecl = static_cast<AST::Declaration*>(WalkDeclaration(S->getCalleeDecl()));
_S->directCallee = static_cast<AST::Function*>(WalkDeclaration(S->getDirectCallee())); _S->directCallee = static_cast<AST::Function*>(WalkDeclaration(S->getDirectCallee()));
_S->numArgs = S->getNumArgs(); _S->numArgs = S->getNumArgs();
_S->numCommas = S->getNumCommas(); _S->numCommas = 0; // Removed from Clang
_S->builtinCallee = S->getBuiltinCallee(); _S->builtinCallee = S->getBuiltinCallee();
_S->isCallToStdMove = S->isCallToStdMove(); _S->isCallToStdMove = S->isCallToStdMove();
for (auto _E : S->arguments()) for (auto _E : S->arguments())
@ -1207,7 +1207,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
_S->calleeDecl = static_cast<AST::Declaration*>(WalkDeclaration(S->getCalleeDecl())); _S->calleeDecl = static_cast<AST::Declaration*>(WalkDeclaration(S->getCalleeDecl()));
_S->directCallee = static_cast<AST::Function*>(WalkDeclaration(S->getDirectCallee())); _S->directCallee = static_cast<AST::Function*>(WalkDeclaration(S->getDirectCallee()));
_S->numArgs = S->getNumArgs(); _S->numArgs = S->getNumArgs();
_S->numCommas = S->getNumCommas(); _S->numCommas = 0; // Removed from Clang
_S->builtinCallee = S->getBuiltinCallee(); _S->builtinCallee = S->getBuiltinCallee();
_S->isCallToStdMove = S->isCallToStdMove(); _S->isCallToStdMove = S->isCallToStdMove();
for (auto _E : S->arguments()) for (auto _E : S->arguments())
@ -1241,7 +1241,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
_S->calleeDecl = static_cast<AST::Declaration*>(WalkDeclaration(S->getCalleeDecl())); _S->calleeDecl = static_cast<AST::Declaration*>(WalkDeclaration(S->getCalleeDecl()));
_S->directCallee = static_cast<AST::Function*>(WalkDeclaration(S->getDirectCallee())); _S->directCallee = static_cast<AST::Function*>(WalkDeclaration(S->getDirectCallee()));
_S->numArgs = S->getNumArgs(); _S->numArgs = S->getNumArgs();
_S->numCommas = S->getNumCommas(); _S->numCommas = 0; // Removed from Clang
_S->builtinCallee = S->getBuiltinCallee(); _S->builtinCallee = S->getBuiltinCallee();
_S->isCallToStdMove = S->isCallToStdMove(); _S->isCallToStdMove = S->isCallToStdMove();
for (auto _E : S->arguments()) for (auto _E : S->arguments())
@ -1391,7 +1391,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
_S->calleeDecl = static_cast<AST::Declaration*>(WalkDeclaration(S->getCalleeDecl())); _S->calleeDecl = static_cast<AST::Declaration*>(WalkDeclaration(S->getCalleeDecl()));
_S->directCallee = static_cast<AST::Function*>(WalkDeclaration(S->getDirectCallee())); _S->directCallee = static_cast<AST::Function*>(WalkDeclaration(S->getDirectCallee()));
_S->numArgs = S->getNumArgs(); _S->numArgs = S->getNumArgs();
_S->numCommas = S->getNumCommas(); _S->numCommas = 0; // Removed from Clang
_S->builtinCallee = S->getBuiltinCallee(); _S->builtinCallee = S->getBuiltinCallee();
_S->isCallToStdMove = S->isCallToStdMove(); _S->isCallToStdMove = S->isCallToStdMove();
for (auto _E : S->arguments()) for (auto _E : S->arguments())
@ -1850,7 +1850,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
_S->operatorDelete = static_cast<AST::Function*>(WalkDeclaration(S->getOperatorDelete())); _S->operatorDelete = static_cast<AST::Function*>(WalkDeclaration(S->getOperatorDelete()));
_S->allocatedType = GetQualifiedType(S->getAllocatedType()); _S->allocatedType = GetQualifiedType(S->getAllocatedType());
_S->isArray = S->isArray(); _S->isArray = S->isArray();
_S->arraySize = static_cast<AST::Expr*>(WalkExpression(S->getArraySize().getValue())); _S->arraySize = static_cast<AST::Expr*>(WalkExpression(S->getArraySize().value()));
_S->numPlacementArgs = S->getNumPlacementArgs(); _S->numPlacementArgs = S->getNumPlacementArgs();
_S->isParenTypeId = S->isParenTypeId(); _S->isParenTypeId = S->isParenTypeId();
_S->isGlobalNew = S->isGlobalNew(); _S->isGlobalNew = S->isGlobalNew();

32
src/CppParser/Parser.cpp

@ -13,7 +13,7 @@
#include "ELFDumper.h" #include "ELFDumper.h"
#include "APValuePrinter.h" #include "APValuePrinter.h"
#include <llvm/Support/Host.h> #include <llvm/TargetParser/Host.h>
#include <llvm/Support/Path.h> #include <llvm/Support/Path.h>
#include <llvm/Support/raw_ostream.h> #include <llvm/Support/raw_ostream.h>
#include <llvm/Support/TargetSelect.h> #include <llvm/Support/TargetSelect.h>
@ -880,11 +880,9 @@ static clang::CXXRecordDecl* GetCXXRecordDeclFromTemplateName(const clang::Templ
switch (Name.getKind()) { switch (Name.getKind()) {
case clang::TemplateName::Template: case clang::TemplateName::Template:
return dyn_cast<clang::CXXRecordDecl>( return dyn_cast<clang::CXXRecordDecl>(Name.getAsTemplateDecl()->getTemplatedDecl());
Name.getAsTemplateDecl()->getTemplatedDecl());
case clang::TemplateName::QualifiedTemplate: case clang::TemplateName::QualifiedTemplate:
return dyn_cast<clang::CXXRecordDecl>( return GetCXXRecordDeclFromTemplateName(Name.getAsQualifiedTemplateName()->getUnderlyingTemplate());
Name.getAsQualifiedTemplateName()->getTemplateDecl()->getTemplatedDecl());
default: default:
assert(0 && "Unknown template name kind"); assert(0 && "Unknown template name kind");
return nullptr; return nullptr;
@ -902,7 +900,7 @@ static clang::CXXRecordDecl* GetCXXRecordDeclFromBaseType(const clang::QualType&
else if (auto Injected = Ty->getAs<clang::InjectedClassNameType>()) else if (auto Injected = Ty->getAs<clang::InjectedClassNameType>())
return Injected->getDecl(); return Injected->getDecl();
assert("Could not get base CXX record from type"); assert(0 && "Could not get base CXX record from type");
return nullptr; return nullptr;
} }
@ -2604,7 +2602,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
{ {
auto TO = Type->getAs<clang::TypeOfType>(); auto TO = Type->getAs<clang::TypeOfType>();
Ty = WalkType(TO->getUnderlyingType()); Ty = WalkType(TO->getUnmodifiedType());
break; break;
} }
case clang::Type::TypeOfExpr: case clang::Type::TypeOfExpr:
@ -2666,8 +2664,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
TSTL = &TSpecTL; TSTL = &TSpecTL;
} }
ArrayRef<clang::TemplateArgument> TSArgs(TS->getArgs(), TS->getNumArgs()); TemplateArgumentList TArgs(TemplateArgumentList::OnStack, TS->template_arguments());
TemplateArgumentList TArgs(TemplateArgumentList::OnStack, TSArgs);
TST->Arguments = WalkTemplateArgumentList(&TArgs, TSTL); TST->Arguments = WalkTemplateArgumentList(&TArgs, TSTL);
Ty = TST; Ty = TST;
@ -2709,8 +2706,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
TSTL = &TSpecTL; TSTL = &TSpecTL;
} }
ArrayRef<clang::TemplateArgument> TSArgs(TS->getArgs(), TS->getNumArgs()); TemplateArgumentList TArgs(TemplateArgumentList::OnStack, TS->template_arguments());
TemplateArgumentList TArgs(TemplateArgumentList::OnStack, TSArgs);
TST->Arguments = WalkTemplateArgumentList(&TArgs, TSTL); TST->Arguments = WalkTemplateArgumentList(&TArgs, TSTL);
Ty = TST; Ty = TST;
@ -2773,9 +2769,9 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
auto RepTy = TP->getReplacementType(); auto RepTy = TP->getReplacementType();
TPT->replacement = GetQualifiedType(RepTy, &Next); TPT->replacement = GetQualifiedType(RepTy, &Next);
TPT->replacedParameter = (TemplateParameterType*) TPT->replacedParameter = (TemplateParameterType*)
WalkType(clang::QualType(TP->getReplacedParameter(), 0), 0); WalkType(c->getASTContext().getTypeDeclType(TP->getReplacedParameter()), 0);
TPT->replacedParameter->parameter = WalkTypeTemplateParameter( TPT->replacedParameter->parameter = WalkTypeTemplateParameter(
TP->getReplacedParameter()->getDecl()); TP->getReplacedParameter());
Ty = TPT; Ty = TPT;
break; break;
@ -4397,10 +4393,8 @@ bool Parser::SetupSourceFiles(const std::vector<std::string>& SourceFiles,
std::vector<const clang::FileEntry*>& FileEntries) std::vector<const clang::FileEntry*>& FileEntries)
{ {
// Check that the file is reachable. // Check that the file is reachable.
clang::ConstSearchDirIterator *Dir; clang::ConstSearchDirIterator *Dir = 0;
llvm::SmallVector< llvm::ArrayRef<std::pair<const clang::FileEntry*, clang::DirectoryEntryRef>> Includers;
std::pair<const clang::FileEntry *, const clang::DirectoryEntry *>,
0> Includers;
for (const auto& SourceFile : SourceFiles) for (const auto& SourceFile : SourceFiles)
{ {
@ -4914,8 +4908,8 @@ ParserTargetInfo* Parser::GetTargetInfo()
parserTargetInfo->longDoubleWidth = TI.getLongDoubleWidth(); parserTargetInfo->longDoubleWidth = TI.getLongDoubleWidth();
parserTargetInfo->longLongAlign = TI.getLongLongAlign(); parserTargetInfo->longLongAlign = TI.getLongLongAlign();
parserTargetInfo->longLongWidth = TI.getLongLongWidth(); parserTargetInfo->longLongWidth = TI.getLongLongWidth();
parserTargetInfo->pointerAlign = TI.getPointerAlign(0); parserTargetInfo->pointerAlign = TI.getPointerAlign(clang::LangAS::Default);
parserTargetInfo->pointerWidth = TI.getPointerWidth(0); parserTargetInfo->pointerWidth = TI.getPointerWidth(clang::LangAS::Default);
parserTargetInfo->wCharAlign = TI.getWCharAlign(); parserTargetInfo->wCharAlign = TI.getWCharAlign();
parserTargetInfo->wCharWidth = TI.getWCharWidth(); parserTargetInfo->wCharWidth = TI.getWCharWidth();
parserTargetInfo->float128Align = TI.getFloat128Align(); parserTargetInfo->float128Align = TI.getFloat128Align();

4
src/CppParser/premake5.lua

@ -4,6 +4,7 @@ clang_msvc_flags =
"/wd4355", "/wd4996", "/wd4624", "/wd4291", "/wd4355", "/wd4996", "/wd4624", "/wd4291",
"/wd4251", "/wd4251",
"/wd4141", -- 'inline' : used more than once "/wd4141", -- 'inline' : used more than once
"/Zc:preprocessor" -- needed for newer Clang Options.inc (VA_ARGS)
} }
if EnableNativeProjects() then if EnableNativeProjects() then
@ -20,6 +21,9 @@ project "CppSharp.CppParser"
linkgroups "On" linkgroups "On"
end end
filter "toolset:gcc*"
buildoptions { "-Wno-nonnull" }
filter "toolset:msc*" filter "toolset:msc*"
buildoptions { clang_msvc_flags } buildoptions { clang_msvc_flags }

1
src/Generator/Generators/CSharp/CSharpCommentPrinter.cs

@ -37,6 +37,7 @@ namespace CppSharp.Generators.CSharp
blockCommandComment.ParagraphComment.GetCommentSections(sections); blockCommandComment.ParagraphComment.GetCommentSections(sections);
break; break;
case CommentCommandKind.Return: case CommentCommandKind.Return:
case CommentCommandKind.Returns:
sections.Add(new Section(CommentElement.Returns)); sections.Add(new Section(CommentElement.Returns));
blockCommandComment.ParagraphComment.GetCommentSections(sections); blockCommandComment.ParagraphComment.GetCommentSections(sections);
break; break;

13
src/Parser/ParserOptions.cs

@ -377,6 +377,15 @@ namespace CppSharp.Parser
AddArguments("-fno-rtti"); AddArguments("-fno-rtti");
} }
internal string BuiltinsDirBasePath
{
get
{
var version = ClangVersion.Split(".").First();
return Path.Combine("lib", "clang", version, "include");
}
}
public string BuiltinsDir public string BuiltinsDir
{ {
get get
@ -385,7 +394,7 @@ namespace CppSharp.Parser
if (assemblyDir == null) if (assemblyDir == null)
throw new InvalidOperationException(); throw new InvalidOperationException();
return Path.Combine(assemblyDir, "lib", "clang", ClangVersion, "include"); return Path.Combine(assemblyDir, BuiltinsDirBasePath);
} }
} }
@ -393,7 +402,7 @@ namespace CppSharp.Parser
{ {
// Check that the builtin includes folder exists. // Check that the builtin includes folder exists.
if (!Directory.Exists(BuiltinsDir)) if (!Directory.Exists(BuiltinsDir))
throw new Exception($"Clang resource folder 'lib/clang/{ClangVersion}/include' was not found."); throw new Exception($"Clang resource folder '{BuiltinsDirBasePath}' was not found.");
switch (targetPlatform) switch (targetPlatform)
{ {

Loading…
Cancel
Save