diff options
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 85 | ||||
-rw-r--r-- | clang/lib/Frontend/ChainedIncludesSource.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Frontend/CreateInvocationFromCommandLine.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Frontend/FrontendActions.cpp | 16 | ||||
-rw-r--r-- | clang/lib/Frontend/MultiplexConsumer.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Frontend/SerializedDiagnosticPrinter.cpp | 2 |
9 files changed, 67 insertions, 81 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index a3ebd41a586..570ff9ccfb5 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -677,7 +677,7 @@ ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename, bool CaptureDiagnostics, bool AllowPCHWithCompilerErrors, bool UserFilesAreVolatile) { - OwningPtr<ASTUnit> AST(new ASTUnit(true)); + std::unique_ptr<ASTUnit> AST(new ASTUnit(true)); // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar<ASTUnit> @@ -1055,7 +1055,7 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) { } // Create the compiler instance to use for building the AST. - OwningPtr<CompilerInstance> Clang(new CompilerInstance()); + std::unique_ptr<CompilerInstance> Clang(new CompilerInstance()); // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar<CompilerInstance> @@ -1141,10 +1141,10 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) { // Keep track of the override buffer; SavedMainFileBuffer = OverrideMainBuffer; } - - OwningPtr<TopLevelDeclTrackerAction> Act( - new TopLevelDeclTrackerAction(*this)); - + + std::unique_ptr<TopLevelDeclTrackerAction> Act( + new TopLevelDeclTrackerAction(*this)); + // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar<TopLevelDeclTrackerAction> ActCleanup(Act.get()); @@ -1406,7 +1406,7 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble( = ComputePreamble(*PreambleInvocation, MaxLines, CreatedPreambleBuffer); // If ComputePreamble() Take ownership of the preamble buffer. - OwningPtr<llvm::MemoryBuffer> OwnedPreambleBuffer; + std::unique_ptr<llvm::MemoryBuffer> OwnedPreambleBuffer; if (CreatedPreambleBuffer) OwnedPreambleBuffer.reset(NewPreamble.first); @@ -1587,7 +1587,7 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble( PreprocessorOpts.PrecompiledPreambleBytes.second = false; // Create the compiler instance to use for building the precompiled preamble. - OwningPtr<CompilerInstance> Clang(new CompilerInstance()); + std::unique_ptr<CompilerInstance> Clang(new CompilerInstance()); // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar<CompilerInstance> @@ -1638,8 +1638,8 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble( // Create the source manager. Clang->setSourceManager(new SourceManager(getDiagnostics(), Clang->getFileManager())); - - OwningPtr<PrecompilePreambleAction> Act; + + std::unique_ptr<PrecompilePreambleAction> Act; Act.reset(new PrecompilePreambleAction(*this)); if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) { llvm::sys::fs::remove(FrontendOpts.OutputFile); @@ -1786,7 +1786,7 @@ ASTUnit *ASTUnit::create(CompilerInvocation *CI, IntrusiveRefCntPtr<DiagnosticsEngine> Diags, bool CaptureDiagnostics, bool UserFilesAreVolatile) { - OwningPtr<ASTUnit> AST; + std::unique_ptr<ASTUnit> AST; AST.reset(new ASTUnit(false)); ConfigureDiags(Diags, 0, 0, *AST, CaptureDiagnostics); AST->Diagnostics = Diags; @@ -1800,22 +1800,16 @@ ASTUnit *ASTUnit::create(CompilerInvocation *CI, return AST.release(); } -ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(CompilerInvocation *CI, - IntrusiveRefCntPtr<DiagnosticsEngine> Diags, - ASTFrontendAction *Action, - ASTUnit *Unit, - bool Persistent, - StringRef ResourceFilesPath, - bool OnlyLocalDecls, - bool CaptureDiagnostics, - bool PrecompilePreamble, - bool CacheCodeCompletionResults, - bool IncludeBriefCommentsInCodeCompletion, - bool UserFilesAreVolatile, - OwningPtr<ASTUnit> *ErrAST) { +ASTUnit *ASTUnit::LoadFromCompilerInvocationAction( + CompilerInvocation *CI, IntrusiveRefCntPtr<DiagnosticsEngine> Diags, + ASTFrontendAction *Action, ASTUnit *Unit, bool Persistent, + StringRef ResourceFilesPath, bool OnlyLocalDecls, bool CaptureDiagnostics, + bool PrecompilePreamble, bool CacheCodeCompletionResults, + bool IncludeBriefCommentsInCodeCompletion, bool UserFilesAreVolatile, + std::unique_ptr<ASTUnit> *ErrAST) { assert(CI && "A CompilerInvocation is required"); - OwningPtr<ASTUnit> OwnAST; + std::unique_ptr<ASTUnit> OwnAST; ASTUnit *AST = Unit; if (!AST) { // Create the AST unit. @@ -1849,7 +1843,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(CompilerInvocation *CI, ProcessWarningOptions(AST->getDiagnostics(), CI->getDiagnosticOpts()); // Create the compiler instance to use for building the AST. - OwningPtr<CompilerInstance> Clang(new CompilerInstance()); + std::unique_ptr<CompilerInstance> Clang(new CompilerInstance()); // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar<CompilerInstance> @@ -1895,7 +1889,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(CompilerInvocation *CI, ASTFrontendAction *Act = Action; - OwningPtr<TopLevelDeclTrackerAction> TrackerAct; + std::unique_ptr<TopLevelDeclTrackerAction> TrackerAct; if (!Act) { TrackerAct.reset(new TopLevelDeclTrackerAction(*AST)); Act = TrackerAct.get(); @@ -1978,7 +1972,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI, bool IncludeBriefCommentsInCodeCompletion, bool UserFilesAreVolatile) { // Create the AST unit. - OwningPtr<ASTUnit> AST; + std::unique_ptr<ASTUnit> AST; AST.reset(new ASTUnit(false)); ConfigureDiags(Diags, 0, 0, *AST, CaptureDiagnostics); AST->Diagnostics = Diags; @@ -2004,23 +1998,16 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI, : AST.release(); } -ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, - const char **ArgEnd, - IntrusiveRefCntPtr<DiagnosticsEngine> Diags, - StringRef ResourceFilesPath, - bool OnlyLocalDecls, - bool CaptureDiagnostics, - ArrayRef<RemappedFile> RemappedFiles, - bool RemappedFilesKeepOriginalName, - bool PrecompilePreamble, - TranslationUnitKind TUKind, - bool CacheCodeCompletionResults, - bool IncludeBriefCommentsInCodeCompletion, - bool AllowPCHWithCompilerErrors, - bool SkipFunctionBodies, - bool UserFilesAreVolatile, - bool ForSerialization, - OwningPtr<ASTUnit> *ErrAST) { +ASTUnit *ASTUnit::LoadFromCommandLine( + const char **ArgBegin, const char **ArgEnd, + IntrusiveRefCntPtr<DiagnosticsEngine> Diags, StringRef ResourceFilesPath, + bool OnlyLocalDecls, bool CaptureDiagnostics, + ArrayRef<RemappedFile> RemappedFiles, bool RemappedFilesKeepOriginalName, + bool PrecompilePreamble, TranslationUnitKind TUKind, + bool CacheCodeCompletionResults, bool IncludeBriefCommentsInCodeCompletion, + bool AllowPCHWithCompilerErrors, bool SkipFunctionBodies, + bool UserFilesAreVolatile, bool ForSerialization, + std::unique_ptr<ASTUnit> *ErrAST) { if (!Diags.getPtr()) { // No diagnostics engine was provided, so create our own diagnostics object // with the default options. @@ -2058,7 +2045,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, CI->getFrontendOpts().SkipFunctionBodies = SkipFunctionBodies; // Create the AST unit. - OwningPtr<ASTUnit> AST; + std::unique_ptr<ASTUnit> AST; AST.reset(new ASTUnit(false)); ConfigureDiags(Diags, ArgBegin, ArgEnd, *AST, CaptureDiagnostics); AST->Diagnostics = Diags; @@ -2427,7 +2414,7 @@ void ASTUnit::CodeComplete(StringRef File, unsigned Line, unsigned Column, // Set the language options appropriately. LangOpts = *CCInvocation->getLangOpts(); - OwningPtr<CompilerInstance> Clang(new CompilerInstance()); + std::unique_ptr<CompilerInstance> Clang(new CompilerInstance()); // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar<CompilerInstance> @@ -2524,8 +2511,8 @@ void ASTUnit::CodeComplete(StringRef File, unsigned Line, unsigned Column, // Disable the preprocessing record if modules are not enabled. if (!Clang->getLangOpts().Modules) PreprocessorOpts.DetailedRecord = false; - - OwningPtr<SyntaxOnlyAction> Act; + + std::unique_ptr<SyntaxOnlyAction> Act; Act.reset(new SyntaxOnlyAction); if (Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) { Act->Execute(); diff --git a/clang/lib/Frontend/ChainedIncludesSource.cpp b/clang/lib/Frontend/ChainedIncludesSource.cpp index 04753ee0c03..674116034b5 100644 --- a/clang/lib/Frontend/ChainedIncludesSource.cpp +++ b/clang/lib/Frontend/ChainedIncludesSource.cpp @@ -31,7 +31,7 @@ static ASTReader *createASTReader(CompilerInstance &CI, SmallVectorImpl<std::string> &bufNames, ASTDeserializationListener *deserialListener = 0) { Preprocessor &PP = CI.getPreprocessor(); - OwningPtr<ASTReader> Reader; + std::unique_ptr<ASTReader> Reader; Reader.reset(new ASTReader(PP, CI.getASTContext(), /*isysroot=*/"", /*DisableValidation=*/true)); for (unsigned ti = 0; ti < bufNames.size(); ++ti) { @@ -76,7 +76,7 @@ ChainedIncludesSource::create(CompilerInstance &CI) { for (unsigned i = 0, e = includes.size(); i != e; ++i) { bool firstInclude = (i == 0); - OwningPtr<CompilerInvocation> CInvok; + std::unique_ptr<CompilerInvocation> CInvok; CInvok.reset(new CompilerInvocation(CI.getInvocation())); CInvok->getPreprocessorOpts().ChainedIncludes.clear(); @@ -97,7 +97,7 @@ ChainedIncludesSource::create(CompilerInstance &CI) { IntrusiveRefCntPtr<DiagnosticsEngine> Diags( new DiagnosticsEngine(DiagID, &CI.getDiagnosticOpts(), DiagClient)); - OwningPtr<CompilerInstance> Clang(new CompilerInstance()); + std::unique_ptr<CompilerInstance> Clang(new CompilerInstance()); Clang->setInvocation(CInvok.release()); Clang->setDiagnostics(Diags.getPtr()); Clang->setTarget(TargetInfo::CreateTargetInfo(Clang->getDiagnostics(), @@ -111,7 +111,7 @@ ChainedIncludesSource::create(CompilerInstance &CI) { SmallVector<char, 256> serialAST; llvm::raw_svector_ostream OS(serialAST); - OwningPtr<ASTConsumer> consumer; + std::unique_ptr<ASTConsumer> consumer; consumer.reset(new PCHGenerator(Clang->getPreprocessor(), "-", 0, /*isysroot=*/"", &OS)); Clang->getASTContext().setASTMutationListener( diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 086d96fca83..11b5ba9f549 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -147,7 +147,7 @@ static void SetupSerializedDiagnostics(DiagnosticOptions *DiagOpts, DiagnosticsEngine &Diags, StringRef OutputFile) { std::string ErrorInfo; - OwningPtr<llvm::raw_fd_ostream> OS; + std::unique_ptr<llvm::raw_fd_ostream> OS; OS.reset(new llvm::raw_fd_ostream(OutputFile.str().c_str(), ErrorInfo, llvm::sys::fs::F_None)); @@ -334,7 +334,7 @@ CompilerInstance::createPCHExternalASTSource(StringRef Path, void *DeserializationListener, bool Preamble, bool UseGlobalModuleIndex) { - OwningPtr<ASTReader> Reader; + std::unique_ptr<ASTReader> Reader; Reader.reset(new ASTReader(PP, Context, Sysroot.empty() ? "" : Sysroot.c_str(), DisablePCHValidation, @@ -539,7 +539,7 @@ CompilerInstance::createOutputFile(StringRef OutputPath, OutFile = "-"; } - OwningPtr<llvm::raw_fd_ostream> OS; + std::unique_ptr<llvm::raw_fd_ostream> OS; std::string OSFile; if (UseTemporary) { @@ -662,7 +662,7 @@ bool CompilerInstance::InitializeSourceManager(const FrontendInputFile &Input, SourceMgr.createMainFileID(File, Kind); } else { - OwningPtr<llvm::MemoryBuffer> SB; + std::unique_ptr<llvm::MemoryBuffer> SB; if (llvm::error_code ec = llvm::MemoryBuffer::getSTDIN(SB)) { Diags.Report(diag::err_fe_error_reading_stdin) << ec.message(); return false; diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index d28af7c469f..44fbf45bd17 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1669,12 +1669,12 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, bool Success = true; // Parse the arguments. - OwningPtr<OptTable> Opts(createDriverOptTable()); + std::unique_ptr<OptTable> Opts(createDriverOptTable()); const unsigned IncludedFlagsBitmask = options::CC1Option; unsigned MissingArgIndex, MissingArgCount; - OwningPtr<InputArgList> Args( - Opts->ParseArgs(ArgBegin, ArgEnd, MissingArgIndex, MissingArgCount, - IncludedFlagsBitmask)); + std::unique_ptr<InputArgList> Args( + Opts->ParseArgs(ArgBegin, ArgEnd, MissingArgIndex, MissingArgCount, + IncludedFlagsBitmask)); // Check for missing argument error. if (MissingArgCount) { @@ -1834,7 +1834,7 @@ std::string CompilerInvocation::getModuleHash() const { // $sysroot/System/Library/CoreServices/SystemVersion.plist // as part of the module hash. if (!hsOpts.Sysroot.empty()) { - llvm::OwningPtr<llvm::MemoryBuffer> buffer; + std::unique_ptr<llvm::MemoryBuffer> buffer; SmallString<128> systemVersionFile; systemVersionFile += hsOpts.Sysroot; llvm::sys::path::append(systemVersionFile, "System"); diff --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp index 62a89fa1307..ededf9a7577 100644 --- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -52,7 +52,7 @@ clang::createInvocationFromCommandLine(ArrayRef<const char *> ArgList, // Don't check that inputs exist, they may have been remapped. TheDriver.setCheckInputsExist(false); - OwningPtr<driver::Compilation> C(TheDriver.BuildCompilation(Args)); + std::unique_ptr<driver::Compilation> C(TheDriver.BuildCompilation(Args)); // Just print the cc1 options if -### was present. if (C->getArgs().hasArg(driver::options::OPT__HASH_HASH_HASH)) { @@ -78,7 +78,7 @@ clang::createInvocationFromCommandLine(ArrayRef<const char *> ArgList, } const ArgStringList &CCArgs = Cmd->getArguments(); - OwningPtr<CompilerInvocation> CI(new CompilerInvocation()); + std::unique_ptr<CompilerInvocation> CI(new CompilerInvocation()); if (!CompilerInvocation::CreateFromArgs(*CI, const_cast<const char **>(CCArgs.data()), const_cast<const char **>(CCArgs.data()) + diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index f61b3bacc47..24f2ec496cd 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -148,7 +148,7 @@ ASTConsumer* FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI, ie = FrontendPluginRegistry::end(); it != ie; ++it) { if (it->getName() == CI.getFrontendOpts().AddPluginActions[i]) { - OwningPtr<PluginASTAction> P(it->instantiate()); + std::unique_ptr<PluginASTAction> P(it->instantiate()); FrontendAction* c = P.get(); if (P->ParseArgs(CI, CI.getFrontendOpts().AddPluginArgs[i])) Consumers.push_back(c->CreateASTConsumer(CI, InFile)); @@ -220,7 +220,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, for (std::vector<std::string>::const_iterator I = Files.begin(), E = Files.end(); I != E; ++I) { - OwningPtr<llvm::MemoryBuffer> Buffer; + std::unique_ptr<llvm::MemoryBuffer> Buffer; if (llvm::errc::success != llvm::MemoryBuffer::getFile(*I, Buffer)) { CI.getDiagnostics().Report(diag::err_missing_vfs_overlay_file) << *I; goto failure; @@ -307,8 +307,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, if (!usesPreprocessorOnly()) { CI.createASTContext(); - OwningPtr<ASTConsumer> Consumer( - CreateWrappedASTConsumer(CI, InputFile)); + std::unique_ptr<ASTConsumer> Consumer( + CreateWrappedASTConsumer(CI, InputFile)); if (!Consumer) goto failure; diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index 4ed2df3a25c..70c34b9653d 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -344,13 +344,13 @@ void VerifyPCHAction::ExecuteAction() { CompilerInstance &CI = getCompilerInstance(); bool Preamble = CI.getPreprocessorOpts().PrecompiledPreambleBytes.first != 0; const std::string &Sysroot = CI.getHeaderSearchOpts().Sysroot; - OwningPtr<ASTReader> Reader(new ASTReader( - CI.getPreprocessor(), CI.getASTContext(), - Sysroot.empty() ? "" : Sysroot.c_str(), - /*DisableValidation*/false, - /*AllowPCHWithCompilerErrors*/false, - /*AllowConfigurationMismatch*/true, - /*ValidateSystemInputs*/true)); + std::unique_ptr<ASTReader> Reader( + new ASTReader(CI.getPreprocessor(), CI.getASTContext(), + Sysroot.empty() ? "" : Sysroot.c_str(), + /*DisableValidation*/ false, + /*AllowPCHWithCompilerErrors*/ false, + /*AllowConfigurationMismatch*/ true, + /*ValidateSystemInputs*/ true)); Reader->ReadAST(getCurrentFile(), Preamble ? serialization::MK_Preamble @@ -461,7 +461,7 @@ namespace { void DumpModuleInfoAction::ExecuteAction() { // Set up the output file. - llvm::OwningPtr<llvm::raw_fd_ostream> OutFile; + std::unique_ptr<llvm::raw_fd_ostream> OutFile; StringRef OutputFileName = getCompilerInstance().getFrontendOpts().OutputFile; if (!OutputFileName.empty() && OutputFileName != "-") { std::string ErrorInfo; diff --git a/clang/lib/Frontend/MultiplexConsumer.cpp b/clang/lib/Frontend/MultiplexConsumer.cpp index 89aeeb4c0b4..ca7e6d35b19 100644 --- a/clang/lib/Frontend/MultiplexConsumer.cpp +++ b/clang/lib/Frontend/MultiplexConsumer.cpp @@ -184,10 +184,9 @@ void MultiplexASTMutationListener::DeclarationMarkedUsed(const Decl *D) { } // end namespace clang - -MultiplexConsumer::MultiplexConsumer(ArrayRef<ASTConsumer*> C) - : Consumers(C.begin(), C.end()), - MutationListener(0), DeserializationListener(0) { +MultiplexConsumer::MultiplexConsumer(ArrayRef<ASTConsumer *> C) + : Consumers(C.begin(), C.end()), MutationListener(), + DeserializationListener() { // Collect the mutation listeners and deserialization listeners of all // children, and create a multiplex listener each if so. std::vector<ASTMutationListener*> mutationListeners; diff --git a/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp b/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp index bed52b5361b..76784357683 100644 --- a/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp @@ -200,7 +200,7 @@ private: llvm::BitstreamWriter Stream; /// \brief The name of the diagnostics file. - OwningPtr<raw_ostream> OS; + std::unique_ptr<raw_ostream> OS; /// \brief The set of constructed record abbreviations. AbbreviationMap Abbrevs; |