From 299cb912cca1ea2d4da7ea12f337bcbf3217253f Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Wed, 19 Feb 2020 12:19:33 +0700 Subject: [PATCH] Update LLVM to the latest version Signed-off-by: Dimitar Dobrev --- build/LLVM-commit | 2 +- src/CppParser/Comments.cpp | 20 ++++++------ src/CppParser/ParseExpr.cpp | 10 +++--- src/CppParser/ParseStmt.cpp | 2 +- src/CppParser/Parser.cpp | 62 ++++++++++++++++++------------------- 5 files changed, 48 insertions(+), 48 deletions(-) diff --git a/build/LLVM-commit b/build/LLVM-commit index 21242f4d..5db3fd83 100644 --- a/build/LLVM-commit +++ b/build/LLVM-commit @@ -1 +1 @@ -54c522420347e58aa7bae1892cf5c5672b57c875 \ No newline at end of file +80c3ea4e633b440cb4bc2c36856d811353e474bb \ No newline at end of file diff --git a/src/CppParser/Comments.cpp b/src/CppParser/Comments.cpp index ba8c215b..e19390b5 100644 --- a/src/CppParser/Comments.cpp +++ b/src/CppParser/Comments.cpp @@ -41,7 +41,7 @@ RawComment* Parser::WalkRawComment(const clang::RawComment* RC) auto& SM = c->getSourceManager(); auto Comment = new RawComment(); Comment->kind = ConvertRawCommentKind(RC->getKind()); - Comment->text = RC->getRawText(SM); + Comment->text = RC->getRawText(SM).str(); Comment->briefText = RC->getBriefText(c->getASTContext()); return Comment; @@ -94,7 +94,7 @@ static void HandleBlockCommand(const clang::comments::BlockCommandComment *CK, for (unsigned I = 0, E = CK->getNumArgs(); I != E; ++I) { auto Arg = BlockCommandComment::Argument(); - Arg.text = CK->getArgText(I); + Arg.text = CK->getArgText(I).str(); BC->Arguments.push_back(Arg); } } @@ -172,7 +172,7 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C) auto CK = cast(C); auto VL = new VerbatimLineComment(); _Comment = VL; - VL->text = CK->getText(); + VL->text = CK->getText().str(); break; } case Comment::ParagraphCommentKind: @@ -194,13 +194,13 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C) auto TC = new HTMLStartTagComment(); _Comment = TC; HandleInlineContent(CK, TC); - TC->tagName = CK->getTagName(); + TC->tagName = CK->getTagName().str(); for (unsigned I = 0, E = CK->getNumAttrs(); I != E; ++I) { auto A = CK->getAttr(I); auto Attr = HTMLStartTagComment::Attribute(); - Attr.name = A.Name; - Attr.value = A.Value; + Attr.name = A.Name.str(); + Attr.value = A.Value.str(); TC->Attributes.push_back(Attr); } break; @@ -211,7 +211,7 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C) auto TC = new HTMLEndTagComment(); _Comment = TC; HandleInlineContent(CK, TC); - TC->tagName = CK->getTagName(); + TC->tagName = CK->getTagName().str(); break; } case Comment::TextCommentKind: @@ -220,7 +220,7 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C) auto TC = new TextComment(); _Comment = TC; HandleInlineContent(CK, TC); - TC->text = CK->getText(); + TC->text = CK->getText().str(); break; } case Comment::InlineCommandCommentKind: @@ -234,7 +234,7 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C) for (unsigned I = 0, E = CK->getNumArgs(); I != E; ++I) { auto Arg = InlineCommandComment::Argument(); - Arg.text = CK->getArgText(I); + Arg.text = CK->getArgText(I).str(); IC->Arguments.push_back(Arg); } break; @@ -244,7 +244,7 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C) auto CK = cast(C); auto VL = new VerbatimBlockLineComment(); _Comment = VL; - VL->text = CK->getText(); + VL->text = CK->getText().str(); break; } case Comment::NoCommentKind: return nullptr; diff --git a/src/CppParser/ParseExpr.cpp b/src/CppParser/ParseExpr.cpp index d06dcab0..2dc87ea3 100644 --- a/src/CppParser/ParseExpr.cpp +++ b/src/CppParser/ParseExpr.cpp @@ -217,8 +217,8 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr) _S->sourceBitField = static_cast(WalkDeclaration(S->getSourceBitField())); _S->referencedDeclOfCallee = static_cast(WalkDeclaration(S->getReferencedDeclOfCallee())); _S->hasPlaceholderType = S->hasPlaceholderType(); - _S->string = S->getString(); - _S->bytes = S->getBytes(); + _S->string = S->getString().str(); + _S->bytes = S->getBytes().str(); _S->byteLength = S->getByteLength(); _S->length = S->getLength(); _S->charByteWidth = S->getCharByteWidth(); @@ -536,7 +536,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr) _S->opcode = (BinaryOperatorKind) S->getOpcode(); _S->lHS = static_cast(WalkExpression(S->getLHS())); _S->rHS = static_cast(WalkExpression(S->getRHS())); - _S->opcodeStr = S->getOpcodeStr(); + _S->opcodeStr = S->getOpcodeStr().str(); _S->isPtrMemOp = S->isPtrMemOp(); _S->isMultiplicativeOp = S->isMultiplicativeOp(); _S->isAdditiveOp = S->isAdditiveOp(); @@ -574,7 +574,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr) _S->opcode = (BinaryOperatorKind) S->getOpcode(); _S->lHS = static_cast(WalkExpression(S->getLHS())); _S->rHS = static_cast(WalkExpression(S->getRHS())); - _S->opcodeStr = S->getOpcodeStr(); + _S->opcodeStr = S->getOpcodeStr().str(); _S->isPtrMemOp = S->isPtrMemOp(); _S->isMultiplicativeOp = S->isMultiplicativeOp(); _S->isAdditiveOp = S->isAdditiveOp(); @@ -1552,7 +1552,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr) _S->referencedDeclOfCallee = static_cast(WalkDeclaration(S->getReferencedDeclOfCallee())); _S->hasPlaceholderType = S->hasPlaceholderType(); _S->exprOperand = static_cast(WalkExpression(S->getExprOperand())); - _S->uuidStr = S->getUuidStr(); + _S->uuidStr = S->getUuidStr().str(); _S->isTypeOperand = S->isTypeOperand(); _Expr = _S; break; diff --git a/src/CppParser/ParseStmt.cpp b/src/CppParser/ParseStmt.cpp index 69a9ee20..31f4703e 100644 --- a/src/CppParser/ParseStmt.cpp +++ b/src/CppParser/ParseStmt.cpp @@ -244,7 +244,7 @@ AST::Stmt* Parser::WalkStatement(const clang::Stmt* Stmt) } _S->hasBraces = S->hasBraces(); _S->numAsmToks = S->getNumAsmToks(); - _S->asmString = S->getAsmString(); + _S->asmString = S->getAsmString().str(); _Stmt = _S; break; } diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index 70c5c520..d1a3d15e 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -444,7 +444,7 @@ std::string Parser::GetDeclMangledName(const clang::Decl* D) static std::string GetDeclName(const clang::NamedDecl* D) { if (const clang::IdentifierInfo *II = D->getIdentifier()) - return II->getName(); + return II->getName().str(); return D->getNameAsString(); } @@ -466,7 +466,7 @@ static std::string GetDeclUSR(const clang::Decl* D) using namespace clang; SmallString<128> usr; if (!index::generateUSRForDecl(D, usr)) - return usr.str(); + return usr.str().str(); return ""; } @@ -900,7 +900,7 @@ bool Parser::IsSupported(const clang::NamedDecl* ND) { return !c->getSourceManager().isInSystemHeader(ND->getBeginLoc()) || (llvm::isa(ND) && - supportedStdTypes.find(ND->getName()) != supportedStdTypes.end()); + supportedStdTypes.find(ND->getName().str()) != supportedStdTypes.end()); } 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() == "assign" && MD->getNumParams() == 1 && MD->parameters()[0]->getType()->isPointerType())) && - supportedStdTypes.find(MD->getParent()->getName()) != + supportedStdTypes.find(MD->getParent()->getName().str()) != supportedStdTypes.end()); } @@ -988,7 +988,7 @@ void Parser::WalkRecord(const clang::RecordDecl* Record, Class* RC) 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()) { @@ -1203,7 +1203,7 @@ Parser::WalkClassTemplateSpecialization(const clang::ClassTemplateSpecialization auto NS = GetNamespace(CTS); assert(NS && "Expected a valid namespace"); TS->_namespace = NS; - TS->name = CTS->getName(); + TS->name = CTS->getName().str(); TS->templatedDecl = CT; TS->specializationKind = WalkTemplateSpecializationKind(CTS->getSpecializationKind()); CT->Specializations.push_back(TS); @@ -1258,7 +1258,7 @@ Parser::WalkClassTemplatePartialSpecialization(const clang::ClassTemplatePartial auto NS = GetNamespace(CTS); assert(NS && "Expected a valid namespace"); TS->_namespace = NS; - TS->name = CTS->getName(); + TS->name = CTS->getName().str(); TS->templatedDecl = CT; TS->specializationKind = WalkTemplateSpecializationKind(CTS->getSpecializationKind()); CT->Specializations.push_back(TS); @@ -1662,7 +1662,7 @@ Parser::WalkVarTemplateSpecialization(const clang::VarTemplateSpecializationDecl auto NS = GetNamespace(VTS); assert(NS && "Expected a valid namespace"); TS->_namespace = NS; - TS->name = VTS->getName(); + TS->name = VTS->getName().str(); TS->templatedDecl = VT; TS->specializationKind = WalkTemplateSpecializationKind(VTS->getSpecializationKind()); VT->Specializations.push_back(TS); @@ -1702,7 +1702,7 @@ Parser::WalkVarTemplatePartialSpecialization(const clang::VarTemplatePartialSpec auto NS = GetNamespace(VTS); assert(NS && "Expected a valid namespace"); TS->_namespace = NS; - TS->name = VTS->getName(); + TS->name = VTS->getName().str(); TS->templatedDecl = VT; TS->specializationKind = WalkTemplateSpecializationKind(VTS->getSpecializationKind()); VT->Specializations.push_back(TS); @@ -1873,7 +1873,7 @@ Field* Parser::WalkFieldCXX(const clang::FieldDecl* FD, Class* Class) HandleDeclaration(FD, F); F->_namespace = Class; - F->name = FD->getName(); + F->name = FD->getName().str(); auto TL = FD->getTypeSourceInfo()->getTypeLoc(); F->qualifiedType = GetQualifiedType(FD->getType(), &TL); F->access = ConvertToAccess(FD->getAccess()); @@ -1922,7 +1922,7 @@ TranslationUnit* Parser::GetTranslationUnit(clang::SourceLocation Loc, if (Kind) *Kind = LocKind; - auto Unit = opts->ASTContext->FindOrCreateModule(File); + auto Unit = opts->ASTContext->FindOrCreateModule(File.str()); Unit->originalPtr = (void*) Unit; assert(Unit->originalPtr != nullptr); @@ -1983,7 +1983,7 @@ DeclarationContext* Parser::GetNamespace(const clang::Decl* D, if (ND->isAnonymousNamespace()) continue; auto Name = ND->getName(); - DC = DC->FindCreateNamespace(Name); + DC = DC->FindCreateNamespace(Name.str()); ((Namespace*)DC)->isAnonymous = ND->isAnonymousNamespace(); ((Namespace*)DC)->isInline = ND->isInline(); HandleDeclaration(ND, DC); @@ -2629,7 +2629,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, auto TPT = new CppSharp::CppParser::TemplateParameterType(); if (auto Ident = TP->getIdentifier()) - TPT->parameter->name = Ident->getName(); + TPT->parameter->name = Ident->getName().str(); TypeLoc UTL, ETL, ITL, Next; @@ -2730,7 +2730,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, } default: break; } - DNT->identifier = DN->getIdentifier()->getName(); + DNT->identifier = DN->getIdentifier()->getName().str(); Ty = DNT; break; @@ -3375,7 +3375,7 @@ void Parser::WalkVariable(const clang::VarDecl* VD, Variable* Var) { HandleDeclaration(VD, Var); - Var->name = VD->getName(); + Var->name = VD->getName().str(); Var->access = ConvertToAccess(VD->getAccess()); auto TL = VD->getTypeSourceInfo()->getTypeLoc(); @@ -3448,7 +3448,7 @@ bool Parser::GetDeclText(clang::SourceRange SR, std::string& Text) auto Range = CharSourceRange::getTokenRange(SR); bool Invalid; - Text = Lexer::getSourceText(Range, SM, LangOpts, &Invalid); + Text = Lexer::getSourceText(Range, SM, LangOpts, &Invalid).str(); return !Invalid && !Text.empty(); } @@ -3529,8 +3529,8 @@ PreprocessedEntity* Parser::WalkPreprocessedEntity( Definition->lineNumberEnd = SM.getExpansionLineNumber(MD->getLocation()); Entity = Definition; - Definition->name = II->getName().trim(); - Definition->expression = Expression.trim(); + Definition->name = II->getName().trim().str(); + Definition->expression = Expression.trim().str(); } case clang::PreprocessedEntity::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); if (!Invalid) - Decl->debugText = DeclText; + Decl->debugText = DeclText.str(); } void Parser::HandleDeclaration(const clang::Decl* D, Declaration* Decl) @@ -4101,7 +4101,7 @@ void Parser::HandleDiagnostics(ParserResult* res) auto PDiag = ParserDiagnostic(); PDiag.fileName = FileName.str(); - PDiag.message = Diag.Message.str(); + PDiag.message = Diag.Message.str().str(); PDiag.lineNumber = 0; PDiag.columnNumber = 0; @@ -4209,7 +4209,7 @@ void SemaConsumer::HandleTranslationUnit(clang::ASTContext& Ctx) { auto FileEntry = FileEntries[0]; auto FileName = FileEntry->getName(); - auto Unit = Parser.opts->ASTContext->FindOrCreateModule(FileName); + auto Unit = Parser.opts->ASTContext->FindOrCreateModule(FileName.str()); auto TU = Ctx.getTranslationUnitDecl(); Parser.HandleDeclaration(TU, Unit); @@ -4276,12 +4276,12 @@ ParserResultKind Parser::ParseArchive(llvm::StringRef File, { auto LibName = File; NativeLib = new NativeLibrary(); - NativeLib->fileName = LibName; + NativeLib->fileName = LibName.str(); for(auto it = Archive->symbol_begin(); it != Archive->symbol_end(); ++it) { llvm::StringRef SymRef = it->getName(); - NativeLib->Symbols.push_back(SymRef); + NativeLib->Symbols.push_back(SymRef.str()); } return ParserResultKind::Success; @@ -4304,7 +4304,7 @@ static void ReadELFDependencies(const llvm::object::ELFFile* ELFFile, CppS { ELFDumper ELFDumper(ELFFile); for (const auto& Dependency : ELFDumper.getNeededLibraries()) - NativeLib->Dependencies.push_back(Dependency); + NativeLib->Dependencies.push_back(Dependency.str()); } ParserResultKind Parser::ParseSharedLib(llvm::StringRef File, @@ -4313,7 +4313,7 @@ ParserResultKind Parser::ParseSharedLib(llvm::StringRef File, { auto LibName = File; NativeLib = new NativeLibrary(); - NativeLib->fileName = LibName; + NativeLib->fileName = LibName.str(); NativeLib->archType = ConvertArchType(ObjectFile->getArch()); if (ObjectFile->isELF()) @@ -4357,13 +4357,13 @@ ParserResultKind Parser::ParseSharedLib(llvm::StringRef File, { llvm::StringRef Symbol; if (!ExportedSymbol.getSymbolName(Symbol)) - NativeLib->Symbols.push_back(Symbol); + NativeLib->Symbols.push_back(Symbol.str()); } for (auto ImportedSymbol : COFFObjectFile->import_directories()) { llvm::StringRef Name; if (!ImportedSymbol.getName(Name) && (Name.endswith(".dll") || Name.endswith(".DLL"))) - NativeLib->Dependencies.push_back(Name); + NativeLib->Dependencies.push_back(Name.str()); } return ParserResultKind::Success; } @@ -4382,7 +4382,7 @@ ParserResultKind Parser::ParseSharedLib(llvm::StringRef File, { auto dl = MachOObjectFile->getDylibIDLoadCommand(Load); 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 @@ -4393,7 +4393,7 @@ ParserResultKind Parser::ParseSharedLib(llvm::StringRef File, { if ((Symbol.getFlags() & llvm::object::BasicSymbolRef::Flags::SF_Exported) && !(Symbol.getFlags() & llvm::object::BasicSymbolRef::Flags::SF_Undefined)) - NativeLib->Symbols.push_back(Symbol.getName().get()); + NativeLib->Symbols.push_back(Symbol.getName().get().str()); } else { @@ -4414,7 +4414,7 @@ ParserResultKind Parser::ReadSymbols(llvm::StringRef File, { auto LibName = File; NativeLib = new NativeLibrary(); - NativeLib->fileName = LibName; + NativeLib->fileName = LibName.str(); for (auto it = Begin; it != End; ++it) { @@ -4510,7 +4510,7 @@ ParserTargetInfo* Parser::GetTargetInfo() auto parserTargetInfo = new ParserTargetInfo(); auto& TI = c->getTarget(); - parserTargetInfo->ABI = TI.getABI(); + parserTargetInfo->ABI = TI.getABI().str(); parserTargetInfo->char16Type = ConvertIntType(TI.getChar16Type()); parserTargetInfo->char32Type = ConvertIntType(TI.getChar32Type());