Browse Source

Update LLVM to the latest version

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1294/head
Dimitar Dobrev 6 years ago
parent
commit
299cb912cc
  1. 2
      build/LLVM-commit
  2. 20
      src/CppParser/Comments.cpp
  3. 10
      src/CppParser/ParseExpr.cpp
  4. 2
      src/CppParser/ParseStmt.cpp
  5. 62
      src/CppParser/Parser.cpp

2
build/LLVM-commit

@ -1 +1 @@
54c522420347e58aa7bae1892cf5c5672b57c875 80c3ea4e633b440cb4bc2c36856d811353e474bb

20
src/CppParser/Comments.cpp

@ -41,7 +41,7 @@ RawComment* Parser::WalkRawComment(const clang::RawComment* RC)
auto& SM = c->getSourceManager(); auto& SM = c->getSourceManager();
auto Comment = new RawComment(); auto Comment = new RawComment();
Comment->kind = ConvertRawCommentKind(RC->getKind()); Comment->kind = ConvertRawCommentKind(RC->getKind());
Comment->text = RC->getRawText(SM); Comment->text = RC->getRawText(SM).str();
Comment->briefText = RC->getBriefText(c->getASTContext()); Comment->briefText = RC->getBriefText(c->getASTContext());
return Comment; return Comment;
@ -94,7 +94,7 @@ static void HandleBlockCommand(const clang::comments::BlockCommandComment *CK,
for (unsigned I = 0, E = CK->getNumArgs(); I != E; ++I) for (unsigned I = 0, E = CK->getNumArgs(); I != E; ++I)
{ {
auto Arg = BlockCommandComment::Argument(); auto Arg = BlockCommandComment::Argument();
Arg.text = CK->getArgText(I); Arg.text = CK->getArgText(I).str();
BC->Arguments.push_back(Arg); BC->Arguments.push_back(Arg);
} }
} }
@ -172,7 +172,7 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C)
auto CK = cast<clang::comments::VerbatimLineComment>(C); auto CK = cast<clang::comments::VerbatimLineComment>(C);
auto VL = new VerbatimLineComment(); auto VL = new VerbatimLineComment();
_Comment = VL; _Comment = VL;
VL->text = CK->getText(); VL->text = CK->getText().str();
break; break;
} }
case Comment::ParagraphCommentKind: case Comment::ParagraphCommentKind:
@ -194,13 +194,13 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C)
auto TC = new HTMLStartTagComment(); auto TC = new HTMLStartTagComment();
_Comment = TC; _Comment = TC;
HandleInlineContent(CK, TC); HandleInlineContent(CK, TC);
TC->tagName = CK->getTagName(); TC->tagName = CK->getTagName().str();
for (unsigned I = 0, E = CK->getNumAttrs(); I != E; ++I) for (unsigned I = 0, E = CK->getNumAttrs(); I != E; ++I)
{ {
auto A = CK->getAttr(I); auto A = CK->getAttr(I);
auto Attr = HTMLStartTagComment::Attribute(); auto Attr = HTMLStartTagComment::Attribute();
Attr.name = A.Name; Attr.name = A.Name.str();
Attr.value = A.Value; Attr.value = A.Value.str();
TC->Attributes.push_back(Attr); TC->Attributes.push_back(Attr);
} }
break; break;
@ -211,7 +211,7 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C)
auto TC = new HTMLEndTagComment(); auto TC = new HTMLEndTagComment();
_Comment = TC; _Comment = TC;
HandleInlineContent(CK, TC); HandleInlineContent(CK, TC);
TC->tagName = CK->getTagName(); TC->tagName = CK->getTagName().str();
break; break;
} }
case Comment::TextCommentKind: case Comment::TextCommentKind:
@ -220,7 +220,7 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C)
auto TC = new TextComment(); auto TC = new TextComment();
_Comment = TC; _Comment = TC;
HandleInlineContent(CK, TC); HandleInlineContent(CK, TC);
TC->text = CK->getText(); TC->text = CK->getText().str();
break; break;
} }
case Comment::InlineCommandCommentKind: case Comment::InlineCommandCommentKind:
@ -234,7 +234,7 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C)
for (unsigned I = 0, E = CK->getNumArgs(); I != E; ++I) for (unsigned I = 0, E = CK->getNumArgs(); I != E; ++I)
{ {
auto Arg = InlineCommandComment::Argument(); auto Arg = InlineCommandComment::Argument();
Arg.text = CK->getArgText(I); Arg.text = CK->getArgText(I).str();
IC->Arguments.push_back(Arg); IC->Arguments.push_back(Arg);
} }
break; break;
@ -244,7 +244,7 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C)
auto CK = cast<clang::comments::VerbatimBlockLineComment>(C); auto CK = cast<clang::comments::VerbatimBlockLineComment>(C);
auto VL = new VerbatimBlockLineComment(); auto VL = new VerbatimBlockLineComment();
_Comment = VL; _Comment = VL;
VL->text = CK->getText(); VL->text = CK->getText().str();
break; break;
} }
case Comment::NoCommentKind: return nullptr; case Comment::NoCommentKind: return nullptr;

10
src/CppParser/ParseExpr.cpp

@ -217,8 +217,8 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
_S->sourceBitField = static_cast<AST::Field*>(WalkDeclaration(S->getSourceBitField())); _S->sourceBitField = static_cast<AST::Field*>(WalkDeclaration(S->getSourceBitField()));
_S->referencedDeclOfCallee = static_cast<AST::Declaration*>(WalkDeclaration(S->getReferencedDeclOfCallee())); _S->referencedDeclOfCallee = static_cast<AST::Declaration*>(WalkDeclaration(S->getReferencedDeclOfCallee()));
_S->hasPlaceholderType = S->hasPlaceholderType(); _S->hasPlaceholderType = S->hasPlaceholderType();
_S->string = S->getString(); _S->string = S->getString().str();
_S->bytes = S->getBytes(); _S->bytes = S->getBytes().str();
_S->byteLength = S->getByteLength(); _S->byteLength = S->getByteLength();
_S->length = S->getLength(); _S->length = S->getLength();
_S->charByteWidth = S->getCharByteWidth(); _S->charByteWidth = S->getCharByteWidth();
@ -536,7 +536,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
_S->opcode = (BinaryOperatorKind) S->getOpcode(); _S->opcode = (BinaryOperatorKind) S->getOpcode();
_S->lHS = static_cast<AST::Expr*>(WalkExpression(S->getLHS())); _S->lHS = static_cast<AST::Expr*>(WalkExpression(S->getLHS()));
_S->rHS = static_cast<AST::Expr*>(WalkExpression(S->getRHS())); _S->rHS = static_cast<AST::Expr*>(WalkExpression(S->getRHS()));
_S->opcodeStr = S->getOpcodeStr(); _S->opcodeStr = S->getOpcodeStr().str();
_S->isPtrMemOp = S->isPtrMemOp(); _S->isPtrMemOp = S->isPtrMemOp();
_S->isMultiplicativeOp = S->isMultiplicativeOp(); _S->isMultiplicativeOp = S->isMultiplicativeOp();
_S->isAdditiveOp = S->isAdditiveOp(); _S->isAdditiveOp = S->isAdditiveOp();
@ -574,7 +574,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
_S->opcode = (BinaryOperatorKind) S->getOpcode(); _S->opcode = (BinaryOperatorKind) S->getOpcode();
_S->lHS = static_cast<AST::Expr*>(WalkExpression(S->getLHS())); _S->lHS = static_cast<AST::Expr*>(WalkExpression(S->getLHS()));
_S->rHS = static_cast<AST::Expr*>(WalkExpression(S->getRHS())); _S->rHS = static_cast<AST::Expr*>(WalkExpression(S->getRHS()));
_S->opcodeStr = S->getOpcodeStr(); _S->opcodeStr = S->getOpcodeStr().str();
_S->isPtrMemOp = S->isPtrMemOp(); _S->isPtrMemOp = S->isPtrMemOp();
_S->isMultiplicativeOp = S->isMultiplicativeOp(); _S->isMultiplicativeOp = S->isMultiplicativeOp();
_S->isAdditiveOp = S->isAdditiveOp(); _S->isAdditiveOp = S->isAdditiveOp();
@ -1552,7 +1552,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
_S->referencedDeclOfCallee = static_cast<AST::Declaration*>(WalkDeclaration(S->getReferencedDeclOfCallee())); _S->referencedDeclOfCallee = static_cast<AST::Declaration*>(WalkDeclaration(S->getReferencedDeclOfCallee()));
_S->hasPlaceholderType = S->hasPlaceholderType(); _S->hasPlaceholderType = S->hasPlaceholderType();
_S->exprOperand = static_cast<AST::Expr*>(WalkExpression(S->getExprOperand())); _S->exprOperand = static_cast<AST::Expr*>(WalkExpression(S->getExprOperand()));
_S->uuidStr = S->getUuidStr(); _S->uuidStr = S->getUuidStr().str();
_S->isTypeOperand = S->isTypeOperand(); _S->isTypeOperand = S->isTypeOperand();
_Expr = _S; _Expr = _S;
break; break;

2
src/CppParser/ParseStmt.cpp

@ -244,7 +244,7 @@ AST::Stmt* Parser::WalkStatement(const clang::Stmt* Stmt)
} }
_S->hasBraces = S->hasBraces(); _S->hasBraces = S->hasBraces();
_S->numAsmToks = S->getNumAsmToks(); _S->numAsmToks = S->getNumAsmToks();
_S->asmString = S->getAsmString(); _S->asmString = S->getAsmString().str();
_Stmt = _S; _Stmt = _S;
break; break;
} }

62
src/CppParser/Parser.cpp

@ -444,7 +444,7 @@ std::string Parser::GetDeclMangledName(const clang::Decl* D)
static std::string GetDeclName(const clang::NamedDecl* D) static std::string GetDeclName(const clang::NamedDecl* D)
{ {
if (const clang::IdentifierInfo *II = D->getIdentifier()) if (const clang::IdentifierInfo *II = D->getIdentifier())
return II->getName(); return II->getName().str();
return D->getNameAsString(); return D->getNameAsString();
} }
@ -466,7 +466,7 @@ static std::string GetDeclUSR(const clang::Decl* D)
using namespace clang; using namespace clang;
SmallString<128> usr; SmallString<128> usr;
if (!index::generateUSRForDecl(D, usr)) if (!index::generateUSRForDecl(D, usr))
return usr.str(); return usr.str().str();
return "<invalid>"; return "<invalid>";
} }
@ -900,7 +900,7 @@ bool Parser::IsSupported(const clang::NamedDecl* ND)
{ {
return !c->getSourceManager().isInSystemHeader(ND->getBeginLoc()) || return !c->getSourceManager().isInSystemHeader(ND->getBeginLoc()) ||
(llvm::isa<clang::RecordDecl>(ND) && (llvm::isa<clang::RecordDecl>(ND) &&
supportedStdTypes.find(ND->getName()) != supportedStdTypes.end()); supportedStdTypes.find(ND->getName().str()) != supportedStdTypes.end());
} }
bool Parser::IsSupported(const clang::CXXMethodDecl* MD) bool Parser::IsSupported(const clang::CXXMethodDecl* MD)
@ -914,7 +914,7 @@ bool Parser::IsSupported(const clang::CXXMethodDecl* MD)
((MD->getName() == "data" && MD->getNumParams() == 0) || ((MD->getName() == "data" && MD->getNumParams() == 0) ||
(MD->getName() == "assign" && MD->getNumParams() == 1 && (MD->getName() == "assign" && MD->getNumParams() == 1 &&
MD->parameters()[0]->getType()->isPointerType())) && MD->parameters()[0]->getType()->isPointerType())) &&
supportedStdTypes.find(MD->getParent()->getName()) != supportedStdTypes.find(MD->getParent()->getName().str()) !=
supportedStdTypes.end()); supportedStdTypes.end());
} }
@ -988,7 +988,7 @@ void Parser::WalkRecord(const clang::RecordDecl* Record, Class* RC)
if (c->getSourceManager().isInSystemHeader(Record->getBeginLoc())) if (c->getSourceManager().isInSystemHeader(Record->getBeginLoc()))
{ {
if (supportedStdTypes.find(Record->getName()) != supportedStdTypes.end()) if (supportedStdTypes.find(Record->getName().str()) != supportedStdTypes.end())
{ {
for (auto D : Record->decls()) for (auto D : Record->decls())
{ {
@ -1203,7 +1203,7 @@ Parser::WalkClassTemplateSpecialization(const clang::ClassTemplateSpecialization
auto NS = GetNamespace(CTS); auto NS = GetNamespace(CTS);
assert(NS && "Expected a valid namespace"); assert(NS && "Expected a valid namespace");
TS->_namespace = NS; TS->_namespace = NS;
TS->name = CTS->getName(); TS->name = CTS->getName().str();
TS->templatedDecl = CT; TS->templatedDecl = CT;
TS->specializationKind = WalkTemplateSpecializationKind(CTS->getSpecializationKind()); TS->specializationKind = WalkTemplateSpecializationKind(CTS->getSpecializationKind());
CT->Specializations.push_back(TS); CT->Specializations.push_back(TS);
@ -1258,7 +1258,7 @@ Parser::WalkClassTemplatePartialSpecialization(const clang::ClassTemplatePartial
auto NS = GetNamespace(CTS); auto NS = GetNamespace(CTS);
assert(NS && "Expected a valid namespace"); assert(NS && "Expected a valid namespace");
TS->_namespace = NS; TS->_namespace = NS;
TS->name = CTS->getName(); TS->name = CTS->getName().str();
TS->templatedDecl = CT; TS->templatedDecl = CT;
TS->specializationKind = WalkTemplateSpecializationKind(CTS->getSpecializationKind()); TS->specializationKind = WalkTemplateSpecializationKind(CTS->getSpecializationKind());
CT->Specializations.push_back(TS); CT->Specializations.push_back(TS);
@ -1662,7 +1662,7 @@ Parser::WalkVarTemplateSpecialization(const clang::VarTemplateSpecializationDecl
auto NS = GetNamespace(VTS); auto NS = GetNamespace(VTS);
assert(NS && "Expected a valid namespace"); assert(NS && "Expected a valid namespace");
TS->_namespace = NS; TS->_namespace = NS;
TS->name = VTS->getName(); TS->name = VTS->getName().str();
TS->templatedDecl = VT; TS->templatedDecl = VT;
TS->specializationKind = WalkTemplateSpecializationKind(VTS->getSpecializationKind()); TS->specializationKind = WalkTemplateSpecializationKind(VTS->getSpecializationKind());
VT->Specializations.push_back(TS); VT->Specializations.push_back(TS);
@ -1702,7 +1702,7 @@ Parser::WalkVarTemplatePartialSpecialization(const clang::VarTemplatePartialSpec
auto NS = GetNamespace(VTS); auto NS = GetNamespace(VTS);
assert(NS && "Expected a valid namespace"); assert(NS && "Expected a valid namespace");
TS->_namespace = NS; TS->_namespace = NS;
TS->name = VTS->getName(); TS->name = VTS->getName().str();
TS->templatedDecl = VT; TS->templatedDecl = VT;
TS->specializationKind = WalkTemplateSpecializationKind(VTS->getSpecializationKind()); TS->specializationKind = WalkTemplateSpecializationKind(VTS->getSpecializationKind());
VT->Specializations.push_back(TS); VT->Specializations.push_back(TS);
@ -1873,7 +1873,7 @@ Field* Parser::WalkFieldCXX(const clang::FieldDecl* FD, Class* Class)
HandleDeclaration(FD, F); HandleDeclaration(FD, F);
F->_namespace = Class; F->_namespace = Class;
F->name = FD->getName(); F->name = FD->getName().str();
auto TL = FD->getTypeSourceInfo()->getTypeLoc(); auto TL = FD->getTypeSourceInfo()->getTypeLoc();
F->qualifiedType = GetQualifiedType(FD->getType(), &TL); F->qualifiedType = GetQualifiedType(FD->getType(), &TL);
F->access = ConvertToAccess(FD->getAccess()); F->access = ConvertToAccess(FD->getAccess());
@ -1922,7 +1922,7 @@ TranslationUnit* Parser::GetTranslationUnit(clang::SourceLocation Loc,
if (Kind) if (Kind)
*Kind = LocKind; *Kind = LocKind;
auto Unit = opts->ASTContext->FindOrCreateModule(File); auto Unit = opts->ASTContext->FindOrCreateModule(File.str());
Unit->originalPtr = (void*) Unit; Unit->originalPtr = (void*) Unit;
assert(Unit->originalPtr != nullptr); assert(Unit->originalPtr != nullptr);
@ -1983,7 +1983,7 @@ DeclarationContext* Parser::GetNamespace(const clang::Decl* D,
if (ND->isAnonymousNamespace()) if (ND->isAnonymousNamespace())
continue; continue;
auto Name = ND->getName(); auto Name = ND->getName();
DC = DC->FindCreateNamespace(Name); DC = DC->FindCreateNamespace(Name.str());
((Namespace*)DC)->isAnonymous = ND->isAnonymousNamespace(); ((Namespace*)DC)->isAnonymous = ND->isAnonymousNamespace();
((Namespace*)DC)->isInline = ND->isInline(); ((Namespace*)DC)->isInline = ND->isInline();
HandleDeclaration(ND, DC); HandleDeclaration(ND, DC);
@ -2629,7 +2629,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
auto TPT = new CppSharp::CppParser::TemplateParameterType(); auto TPT = new CppSharp::CppParser::TemplateParameterType();
if (auto Ident = TP->getIdentifier()) if (auto Ident = TP->getIdentifier())
TPT->parameter->name = Ident->getName(); TPT->parameter->name = Ident->getName().str();
TypeLoc UTL, ETL, ITL, Next; TypeLoc UTL, ETL, ITL, Next;
@ -2730,7 +2730,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
} }
default: break; default: break;
} }
DNT->identifier = DN->getIdentifier()->getName(); DNT->identifier = DN->getIdentifier()->getName().str();
Ty = DNT; Ty = DNT;
break; break;
@ -3375,7 +3375,7 @@ void Parser::WalkVariable(const clang::VarDecl* VD, Variable* Var)
{ {
HandleDeclaration(VD, Var); HandleDeclaration(VD, Var);
Var->name = VD->getName(); Var->name = VD->getName().str();
Var->access = ConvertToAccess(VD->getAccess()); Var->access = ConvertToAccess(VD->getAccess());
auto TL = VD->getTypeSourceInfo()->getTypeLoc(); auto TL = VD->getTypeSourceInfo()->getTypeLoc();
@ -3448,7 +3448,7 @@ bool Parser::GetDeclText(clang::SourceRange SR, std::string& Text)
auto Range = CharSourceRange::getTokenRange(SR); auto Range = CharSourceRange::getTokenRange(SR);
bool Invalid; bool Invalid;
Text = Lexer::getSourceText(Range, SM, LangOpts, &Invalid); Text = Lexer::getSourceText(Range, SM, LangOpts, &Invalid).str();
return !Invalid && !Text.empty(); return !Invalid && !Text.empty();
} }
@ -3529,8 +3529,8 @@ PreprocessedEntity* Parser::WalkPreprocessedEntity(
Definition->lineNumberEnd = SM.getExpansionLineNumber(MD->getLocation()); Definition->lineNumberEnd = SM.getExpansionLineNumber(MD->getLocation());
Entity = Definition; Entity = Definition;
Definition->name = II->getName().trim(); Definition->name = II->getName().trim().str();
Definition->expression = Expression.trim(); Definition->expression = Expression.trim().str();
} }
case clang::PreprocessedEntity::InclusionDirectiveKind: case clang::PreprocessedEntity::InclusionDirectiveKind:
// nothing to be done for InclusionDirectiveKind // nothing to be done for InclusionDirectiveKind
@ -3722,7 +3722,7 @@ void Parser::HandleOriginalText(const clang::Decl* D, Declaration* Decl)
auto DeclText = clang::Lexer::getSourceText(Range, SM, LangOpts, &Invalid); auto DeclText = clang::Lexer::getSourceText(Range, SM, LangOpts, &Invalid);
if (!Invalid) if (!Invalid)
Decl->debugText = DeclText; Decl->debugText = DeclText.str();
} }
void Parser::HandleDeclaration(const clang::Decl* D, Declaration* Decl) void Parser::HandleDeclaration(const clang::Decl* D, Declaration* Decl)
@ -4101,7 +4101,7 @@ void Parser::HandleDiagnostics(ParserResult* res)
auto PDiag = ParserDiagnostic(); auto PDiag = ParserDiagnostic();
PDiag.fileName = FileName.str(); PDiag.fileName = FileName.str();
PDiag.message = Diag.Message.str(); PDiag.message = Diag.Message.str().str();
PDiag.lineNumber = 0; PDiag.lineNumber = 0;
PDiag.columnNumber = 0; PDiag.columnNumber = 0;
@ -4209,7 +4209,7 @@ void SemaConsumer::HandleTranslationUnit(clang::ASTContext& Ctx)
{ {
auto FileEntry = FileEntries[0]; auto FileEntry = FileEntries[0];
auto FileName = FileEntry->getName(); auto FileName = FileEntry->getName();
auto Unit = Parser.opts->ASTContext->FindOrCreateModule(FileName); auto Unit = Parser.opts->ASTContext->FindOrCreateModule(FileName.str());
auto TU = Ctx.getTranslationUnitDecl(); auto TU = Ctx.getTranslationUnitDecl();
Parser.HandleDeclaration(TU, Unit); Parser.HandleDeclaration(TU, Unit);
@ -4276,12 +4276,12 @@ ParserResultKind Parser::ParseArchive(llvm::StringRef File,
{ {
auto LibName = File; auto LibName = File;
NativeLib = new NativeLibrary(); NativeLib = new NativeLibrary();
NativeLib->fileName = LibName; NativeLib->fileName = LibName.str();
for(auto it = Archive->symbol_begin(); it != Archive->symbol_end(); ++it) for(auto it = Archive->symbol_begin(); it != Archive->symbol_end(); ++it)
{ {
llvm::StringRef SymRef = it->getName(); llvm::StringRef SymRef = it->getName();
NativeLib->Symbols.push_back(SymRef); NativeLib->Symbols.push_back(SymRef.str());
} }
return ParserResultKind::Success; return ParserResultKind::Success;
@ -4304,7 +4304,7 @@ static void ReadELFDependencies(const llvm::object::ELFFile<ELFT>* ELFFile, CppS
{ {
ELFDumper<ELFT> ELFDumper(ELFFile); ELFDumper<ELFT> ELFDumper(ELFFile);
for (const auto& Dependency : ELFDumper.getNeededLibraries()) for (const auto& Dependency : ELFDumper.getNeededLibraries())
NativeLib->Dependencies.push_back(Dependency); NativeLib->Dependencies.push_back(Dependency.str());
} }
ParserResultKind Parser::ParseSharedLib(llvm::StringRef File, ParserResultKind Parser::ParseSharedLib(llvm::StringRef File,
@ -4313,7 +4313,7 @@ ParserResultKind Parser::ParseSharedLib(llvm::StringRef File,
{ {
auto LibName = File; auto LibName = File;
NativeLib = new NativeLibrary(); NativeLib = new NativeLibrary();
NativeLib->fileName = LibName; NativeLib->fileName = LibName.str();
NativeLib->archType = ConvertArchType(ObjectFile->getArch()); NativeLib->archType = ConvertArchType(ObjectFile->getArch());
if (ObjectFile->isELF()) if (ObjectFile->isELF())
@ -4357,13 +4357,13 @@ ParserResultKind Parser::ParseSharedLib(llvm::StringRef File,
{ {
llvm::StringRef Symbol; llvm::StringRef Symbol;
if (!ExportedSymbol.getSymbolName(Symbol)) if (!ExportedSymbol.getSymbolName(Symbol))
NativeLib->Symbols.push_back(Symbol); NativeLib->Symbols.push_back(Symbol.str());
} }
for (auto ImportedSymbol : COFFObjectFile->import_directories()) for (auto ImportedSymbol : COFFObjectFile->import_directories())
{ {
llvm::StringRef Name; llvm::StringRef Name;
if (!ImportedSymbol.getName(Name) && (Name.endswith(".dll") || Name.endswith(".DLL"))) if (!ImportedSymbol.getName(Name) && (Name.endswith(".dll") || Name.endswith(".DLL")))
NativeLib->Dependencies.push_back(Name); NativeLib->Dependencies.push_back(Name.str());
} }
return ParserResultKind::Success; return ParserResultKind::Success;
} }
@ -4382,7 +4382,7 @@ ParserResultKind Parser::ParseSharedLib(llvm::StringRef File,
{ {
auto dl = MachOObjectFile->getDylibIDLoadCommand(Load); auto dl = MachOObjectFile->getDylibIDLoadCommand(Load);
auto lib = llvm::sys::path::filename(Load.Ptr + dl.dylib.name); auto lib = llvm::sys::path::filename(Load.Ptr + dl.dylib.name);
NativeLib->Dependencies.push_back(lib); NativeLib->Dependencies.push_back(lib.str());
} }
} }
// HACK: the correct way is with exported(Err) but it crashes with msvc 32 // HACK: the correct way is with exported(Err) but it crashes with msvc 32
@ -4393,7 +4393,7 @@ ParserResultKind Parser::ParseSharedLib(llvm::StringRef File,
{ {
if ((Symbol.getFlags() & llvm::object::BasicSymbolRef::Flags::SF_Exported) && if ((Symbol.getFlags() & llvm::object::BasicSymbolRef::Flags::SF_Exported) &&
!(Symbol.getFlags() & llvm::object::BasicSymbolRef::Flags::SF_Undefined)) !(Symbol.getFlags() & llvm::object::BasicSymbolRef::Flags::SF_Undefined))
NativeLib->Symbols.push_back(Symbol.getName().get()); NativeLib->Symbols.push_back(Symbol.getName().get().str());
} }
else else
{ {
@ -4414,7 +4414,7 @@ ParserResultKind Parser::ReadSymbols(llvm::StringRef File,
{ {
auto LibName = File; auto LibName = File;
NativeLib = new NativeLibrary(); NativeLib = new NativeLibrary();
NativeLib->fileName = LibName; NativeLib->fileName = LibName.str();
for (auto it = Begin; it != End; ++it) for (auto it = Begin; it != End; ++it)
{ {
@ -4510,7 +4510,7 @@ ParserTargetInfo* Parser::GetTargetInfo()
auto parserTargetInfo = new ParserTargetInfo(); auto parserTargetInfo = new ParserTargetInfo();
auto& TI = c->getTarget(); auto& TI = c->getTarget();
parserTargetInfo->ABI = TI.getABI(); parserTargetInfo->ABI = TI.getABI().str();
parserTargetInfo->char16Type = ConvertIntType(TI.getChar16Type()); parserTargetInfo->char16Type = ConvertIntType(TI.getChar16Type());
parserTargetInfo->char32Type = ConvertIntType(TI.getChar32Type()); parserTargetInfo->char32Type = ConvertIntType(TI.getChar32Type());

Loading…
Cancel
Save