diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-07-31 21:22:58 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-07-31 21:22:58 +0000 |
commit | 5ffd83dbcc34f10e07f6d3e968ae6365869615f4 (patch) | |
tree | 0e9f5cf729dde39f949698fddef45a34e2bc7f44 /contrib/llvm-project/clang/lib/Frontend/ASTUnit.cpp | |
parent | 1799696096df87b52968b8996d00c91e0a5de8d9 (diff) | |
parent | cfca06d7963fa0909f90483b42a6d7d194d01e08 (diff) |
Notes
Diffstat (limited to 'contrib/llvm-project/clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | contrib/llvm-project/clang/lib/Frontend/ASTUnit.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/contrib/llvm-project/clang/lib/Frontend/ASTUnit.cpp b/contrib/llvm-project/clang/lib/Frontend/ASTUnit.cpp index b3264952ff47..57d025b7c32e 100644 --- a/contrib/llvm-project/clang/lib/Frontend/ASTUnit.cpp +++ b/contrib/llvm-project/clang/lib/Frontend/ASTUnit.cpp @@ -224,7 +224,7 @@ struct ASTUnit::ASTWriterData { }; void ASTUnit::clearFileLevelDecls() { - llvm::DeleteContainerSeconds(FileDecls); + FileDecls.clear(); } /// After failing to build a precompiled preamble (due to @@ -784,7 +784,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile( UserFilesAreVolatile); AST->ModuleCache = new InMemoryModuleCache; AST->HSOpts = std::make_shared<HeaderSearchOptions>(); - AST->HSOpts->ModuleFormat = PCHContainerRdr.getFormat(); + AST->HSOpts->ModuleFormat = std::string(PCHContainerRdr.getFormat()); AST->HeaderInfo.reset(new HeaderSearch(AST->HSOpts, AST->getSourceManager(), AST->getDiagnostics(), @@ -847,7 +847,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile( return nullptr; } - AST->OriginalSourceFile = AST->Reader->getOriginalSourceFile(); + AST->OriginalSourceFile = std::string(AST->Reader->getOriginalSourceFile()); PP.setCounterValue(Counter); @@ -1131,7 +1131,8 @@ bool ASTUnit::Parse(std::shared_ptr<PCHContainerOperations> PCHContainerOps, CICleanup(Clang.get()); Clang->setInvocation(CCInvocation); - OriginalSourceFile = Clang->getFrontendOpts().Inputs[0].getFile(); + OriginalSourceFile = + std::string(Clang->getFrontendOpts().Inputs[0].getFile()); // Set up diagnostics, capturing any diagnostics that would // otherwise be dropped. @@ -1260,13 +1261,13 @@ makeStandaloneDiagnostic(const LangOptions &LangOpts, ASTUnit::StandaloneDiagnostic OutDiag; OutDiag.ID = InDiag.getID(); OutDiag.Level = InDiag.getLevel(); - OutDiag.Message = InDiag.getMessage(); + OutDiag.Message = std::string(InDiag.getMessage()); OutDiag.LocOffset = 0; if (InDiag.getLocation().isInvalid()) return OutDiag; const SourceManager &SM = InDiag.getLocation().getManager(); SourceLocation FileLoc = SM.getFileLoc(InDiag.getLocation()); - OutDiag.Filename = SM.getFilename(FileLoc); + OutDiag.Filename = std::string(SM.getFilename(FileLoc)); if (OutDiag.Filename.empty()) return OutDiag; OutDiag.LocOffset = SM.getFileOffset(FileLoc); @@ -1532,7 +1533,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction( if (!ResourceFilesPath.empty()) { // Override the resources path. - CI->getHeaderSearchOpts().ResourceDir = ResourceFilesPath; + CI->getHeaderSearchOpts().ResourceDir = std::string(ResourceFilesPath); } AST->OnlyLocalDecls = OnlyLocalDecls; AST->CaptureDiagnostics = CaptureDiagnostics; @@ -1564,7 +1565,8 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction( CICleanup(Clang.get()); Clang->setInvocation(std::move(CI)); - AST->OriginalSourceFile = Clang->getFrontendOpts().Inputs[0].getFile(); + AST->OriginalSourceFile = + std::string(Clang->getFrontendOpts().Inputs[0].getFile()); // Set up diagnostics, capturing any diagnostics that would // otherwise be dropped. @@ -1767,13 +1769,14 @@ ASTUnit *ASTUnit::LoadFromCommandLine( PPOpts.RetainExcludedConditionalBlocks = RetainExcludedConditionalBlocks; // Override the resources path. - CI->getHeaderSearchOpts().ResourceDir = ResourceFilesPath; + CI->getHeaderSearchOpts().ResourceDir = std::string(ResourceFilesPath); CI->getFrontendOpts().SkipFunctionBodies = SkipFunctionBodies == SkipFunctionBodiesScope::PreambleAndMainFile; if (ModuleFormat) - CI->getHeaderSearchOpts().ModuleFormat = ModuleFormat.getValue(); + CI->getHeaderSearchOpts().ModuleFormat = + std::string(ModuleFormat.getValue()); // Create the AST unit. std::unique_ptr<ASTUnit> AST; @@ -2165,7 +2168,7 @@ void ASTUnit::CodeComplete( assert(IncludeBriefComments == this->IncludeBriefCommentsInCodeCompletion); - FrontendOpts.CodeCompletionAt.FileName = File; + FrontendOpts.CodeCompletionAt.FileName = std::string(File); FrontendOpts.CodeCompletionAt.Line = Line; FrontendOpts.CodeCompletionAt.Column = Column; @@ -2185,7 +2188,8 @@ void ASTUnit::CodeComplete( auto &Inv = *CCInvocation; Clang->setInvocation(std::move(CCInvocation)); - OriginalSourceFile = Clang->getFrontendOpts().Inputs[0].getFile(); + OriginalSourceFile = + std::string(Clang->getFrontendOpts().Inputs[0].getFile()); // Set up diagnostics, capturing any diagnostics produced. Clang->setDiagnostics(&Diag); @@ -2432,9 +2436,9 @@ void ASTUnit::addFileLevelDecl(Decl *D) { if (FID.isInvalid()) return; - LocDeclsTy *&Decls = FileDecls[FID]; + std::unique_ptr<LocDeclsTy> &Decls = FileDecls[FID]; if (!Decls) - Decls = new LocDeclsTy(); + Decls = std::make_unique<LocDeclsTy>(); std::pair<unsigned, Decl *> LocDecl(Offset, D); |