Author: d0k Date: Sun Jun 12 15:05:23 2016 New Revision: 272520 URL: http://llvm.org/viewvc/llvm-project?rev=272520&view=rev Log: Add some std::move where the value is only read otherwise.
This mostly affects smart pointers. No functionality change intended. Modified: cfe/trunk/include/clang/AST/DeclTemplate.h cfe/trunk/include/clang/Driver/Driver.h cfe/trunk/include/clang/Frontend/CompilerInstance.h cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h cfe/trunk/lib/AST/ASTContext.cpp cfe/trunk/lib/Basic/VirtualFileSystem.cpp cfe/trunk/lib/Frontend/ASTUnit.cpp cfe/trunk/lib/Frontend/CompilerInstance.cpp cfe/trunk/lib/Tooling/Tooling.cpp Modified: cfe/trunk/include/clang/AST/DeclTemplate.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=272520&r1=272519&r2=272520&view=diff ============================================================================== --- cfe/trunk/include/clang/AST/DeclTemplate.h (original) +++ cfe/trunk/include/clang/AST/DeclTemplate.h Sun Jun 12 15:05:23 2016 @@ -2356,7 +2356,7 @@ public: bool HasExplicitTemplateArgs, TemplateArgumentListInfo TemplateArgs) { return new (C, DC) ClassScopeFunctionSpecializationDecl( - DC, Loc, FD, HasExplicitTemplateArgs, TemplateArgs); + DC, Loc, FD, HasExplicitTemplateArgs, std::move(TemplateArgs)); } static ClassScopeFunctionSpecializationDecl * Modified: cfe/trunk/include/clang/Driver/Driver.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=272520&r1=272519&r2=272520&view=diff ============================================================================== --- cfe/trunk/include/clang/Driver/Driver.h (original) +++ cfe/trunk/include/clang/Driver/Driver.h Sun Jun 12 15:05:23 2016 @@ -248,7 +248,7 @@ public: void setCheckInputsExist(bool Value) { CheckInputsExist = Value; } const std::string &getTitle() { return DriverTitle; } - void setTitle(std::string Value) { DriverTitle = Value; } + void setTitle(std::string Value) { DriverTitle = std::move(Value); } /// \brief Get the path to the main clang executable. const char *getClangProgramPath() const { Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=272520&r1=272519&r2=272520&view=diff ============================================================================== --- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original) +++ cfe/trunk/include/clang/Frontend/CompilerInstance.h Sun Jun 12 15:05:23 2016 @@ -380,7 +380,7 @@ public: /// \note Most clients should use setFileManager, which will implicitly reset /// the virtual file system to the one contained in the file manager. void setVirtualFileSystem(IntrusiveRefCntPtr<vfs::FileSystem> FS) { - VirtualFileSystem = FS; + VirtualFileSystem = std::move(FS); } /// } Modified: cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h?rev=272520&r1=272519&r2=272520&view=diff ============================================================================== --- cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h (original) +++ cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h Sun Jun 12 15:05:23 2016 @@ -45,7 +45,7 @@ public: /// setPrefix - Set the diagnostic printer prefix string, which will be /// printed at the start of any diagnostics. If empty, no prefix string is /// used. - void setPrefix(std::string Value) { Prefix = Value; } + void setPrefix(std::string Value) { Prefix = std::move(Value); } void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP) override; void EndSourceFile() override; Modified: cfe/trunk/lib/AST/ASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=272520&r1=272519&r2=272520&view=diff ============================================================================== --- cfe/trunk/lib/AST/ASTContext.cpp (original) +++ cfe/trunk/lib/AST/ASTContext.cpp Sun Jun 12 15:05:23 2016 @@ -816,7 +816,7 @@ void ASTContext::AddDeallocation(void (* void ASTContext::setExternalSource(IntrusiveRefCntPtr<ExternalASTSource> Source) { - ExternalSource = Source; + ExternalSource = std::move(Source); } void ASTContext::PrintStats() const { Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=272520&r1=272519&r2=272520&view=diff ============================================================================== --- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original) +++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Sun Jun 12 15:05:23 2016 @@ -280,7 +280,7 @@ directory_iterator RealFileSystem::dir_b // OverlayFileSystem implementation //===-----------------------------------------------------------------------===/ OverlayFileSystem::OverlayFileSystem(IntrusiveRefCntPtr<FileSystem> BaseFS) { - FSList.push_back(BaseFS); + FSList.push_back(std::move(BaseFS)); } void OverlayFileSystem::pushOverlay(IntrusiveRefCntPtr<FileSystem> FS) { @@ -1395,7 +1395,7 @@ RedirectingFileSystem::create(std::uniqu RedirectingFileSystemParser P(Stream); std::unique_ptr<RedirectingFileSystem> FS( - new RedirectingFileSystem(ExternalFS)); + new RedirectingFileSystem(std::move(ExternalFS))); if (!YAMLFilePath.empty()) { // Use the YAML path from -ivfsoverlay to compute the dir to be prefixed @@ -1576,7 +1576,8 @@ vfs::getVFSFromYAML(std::unique_ptr<Memo void *DiagContext, IntrusiveRefCntPtr<FileSystem> ExternalFS) { return RedirectingFileSystem::create(std::move(Buffer), DiagHandler, - YAMLFilePath, DiagContext, ExternalFS); + YAMLFilePath, DiagContext, + std::move(ExternalFS)); } UniqueID vfs::getNextVirtualUniqueID() { Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=272520&r1=272519&r2=272520&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/ASTUnit.cpp (original) +++ cfe/trunk/lib/Frontend/ASTUnit.cpp Sun Jun 12 15:05:23 2016 @@ -1040,7 +1040,7 @@ bool ASTUnit::Parse(std::shared_ptr<PCHC // Create the compiler instance to use for building the AST. std::unique_ptr<CompilerInstance> Clang( - new CompilerInstance(PCHContainerOps)); + new CompilerInstance(std::move(PCHContainerOps))); // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar<CompilerInstance> @@ -1514,7 +1514,7 @@ ASTUnit::getMainBufferWithPrecompiledPre // Create the compiler instance to use for building the precompiled preamble. std::unique_ptr<CompilerInstance> Clang( - new CompilerInstance(PCHContainerOps)); + new CompilerInstance(std::move(PCHContainerOps))); // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar<CompilerInstance> @@ -1776,7 +1776,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvoca // Create the compiler instance to use for building the AST. std::unique_ptr<CompilerInstance> Clang( - new CompilerInstance(PCHContainerOps)); + new CompilerInstance(std::move(PCHContainerOps))); // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar<CompilerInstance> @@ -1896,7 +1896,7 @@ bool ASTUnit::LoadFromCompilerInvocation llvm::CrashRecoveryContextCleanupRegistrar<llvm::MemoryBuffer> MemBufferCleanup(OverrideMainBuffer.get()); - return Parse(PCHContainerOps, std::move(OverrideMainBuffer)); + return Parse(std::move(PCHContainerOps), std::move(OverrideMainBuffer)); } std::unique_ptr<ASTUnit> ASTUnit::LoadFromCompilerInvocation( @@ -1929,7 +1929,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFr llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> > DiagCleanup(Diags.get()); - if (AST->LoadFromCompilerInvocation(PCHContainerOps, + if (AST->LoadFromCompilerInvocation(std::move(PCHContainerOps), PrecompilePreambleAfterNParses)) return nullptr; return AST; @@ -2012,7 +2012,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine( llvm::CrashRecoveryContextCleanupRegistrar<ASTUnit> ASTUnitCleanup(AST.get()); - if (AST->LoadFromCompilerInvocation(PCHContainerOps, + if (AST->LoadFromCompilerInvocation(std::move(PCHContainerOps), PrecompilePreambleAfterNParses)) { // Some error occurred, if caller wants to examine diagnostics, pass it the // ASTUnit. @@ -2062,7 +2062,8 @@ bool ASTUnit::Reparse(std::shared_ptr<PC getDiagnostics().setNumWarnings(NumWarningsInPreamble); // Parse the sources - bool Result = Parse(PCHContainerOps, std::move(OverrideMainBuffer)); + bool Result = + Parse(std::move(PCHContainerOps), std::move(OverrideMainBuffer)); // If we're caching global code-completion results, and the top-level // declarations have changed, clear out the code-completion cache. Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=272520&r1=272519&r2=272520&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Sun Jun 12 15:05:23 2016 @@ -127,7 +127,7 @@ IntrusiveRefCntPtr<ASTReader> CompilerIn return ModuleManager; } void CompilerInstance::setModuleManager(IntrusiveRefCntPtr<ASTReader> Reader) { - ModuleManager = Reader; + ModuleManager = std::move(Reader); } std::shared_ptr<ModuleDependencyCollector> @@ -137,7 +137,7 @@ CompilerInstance::getModuleDepCollector( void CompilerInstance::setModuleDepCollector( std::shared_ptr<ModuleDependencyCollector> Collector) { - ModuleDepCollector = Collector; + ModuleDepCollector = std::move(Collector); } // Diagnostics Modified: cfe/trunk/lib/Tooling/Tooling.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Tooling.cpp?rev=272520&r1=272519&r2=272520&view=diff ============================================================================== --- cfe/trunk/lib/Tooling/Tooling.cpp (original) +++ cfe/trunk/lib/Tooling/Tooling.cpp Sun Jun 12 15:05:23 2016 @@ -104,7 +104,8 @@ bool runToolOnCode(clang::FrontendAction const Twine &FileName, std::shared_ptr<PCHContainerOperations> PCHContainerOps) { return runToolOnCodeWithArgs(ToolAction, Code, std::vector<std::string>(), - FileName, "clang-tool", PCHContainerOps); + FileName, "clang-tool", + std::move(PCHContainerOps)); } static std::vector<std::string> @@ -136,7 +137,8 @@ bool runToolOnCodeWithArgs( llvm::IntrusiveRefCntPtr<FileManager> Files( new FileManager(FileSystemOptions(), OverlayFileSystem)); ToolInvocation Invocation(getSyntaxOnlyToolArgs(ToolName, Args, FileNameRef), - ToolAction, Files.get(), PCHContainerOps); + ToolAction, Files.get(), + std::move(PCHContainerOps)); SmallString<1024> CodeStorage; InMemoryFileSystem->addFile(FileNameRef, 0, @@ -265,7 +267,7 @@ bool ToolInvocation::run() { Input.release()); } return runInvocation(BinaryName, Compilation.get(), Invocation.release(), - PCHContainerOps); + std::move(PCHContainerOps)); } bool ToolInvocation::runInvocation( @@ -279,7 +281,7 @@ bool ToolInvocation::runInvocation( llvm::errs() << "\n"; } - return Action->runInvocation(Invocation, Files, PCHContainerOps, + return Action->runInvocation(Invocation, Files, std::move(PCHContainerOps), DiagConsumer); } @@ -288,7 +290,7 @@ bool FrontendActionFactory::runInvocatio std::shared_ptr<PCHContainerOperations> PCHContainerOps, DiagnosticConsumer *DiagConsumer) { // Create a compiler instance to handle the actual work. - clang::CompilerInstance Compiler(PCHContainerOps); + clang::CompilerInstance Compiler(std::move(PCHContainerOps)); Compiler.setInvocation(Invocation); Compiler.setFileManager(Files); @@ -332,9 +334,10 @@ void ClangTool::mapVirtualFile(StringRef void ClangTool::appendArgumentsAdjuster(ArgumentsAdjuster Adjuster) { if (ArgsAdjuster) - ArgsAdjuster = combineAdjusters(ArgsAdjuster, Adjuster); + ArgsAdjuster = + combineAdjusters(std::move(ArgsAdjuster), std::move(Adjuster)); else - ArgsAdjuster = Adjuster; + ArgsAdjuster = std::move(Adjuster); } void ClangTool::clearArgumentsAdjusters() { @@ -466,7 +469,7 @@ public: std::shared_ptr<PCHContainerOperations> PCHContainerOps, DiagnosticConsumer *DiagConsumer) override { std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromCompilerInvocation( - Invocation, PCHContainerOps, + Invocation, std::move(PCHContainerOps), CompilerInstance::createDiagnostics(&Invocation->getDiagnosticOpts(), DiagConsumer, /*ShouldOwnClient=*/false), @@ -490,7 +493,7 @@ std::unique_ptr<ASTUnit> buildASTFromCode(const Twine &Code, const Twine &FileName, std::shared_ptr<PCHContainerOperations> PCHContainerOps) { return buildASTFromCodeWithArgs(Code, std::vector<std::string>(), FileName, - "clang-tool", PCHContainerOps); + "clang-tool", std::move(PCHContainerOps)); } std::unique_ptr<ASTUnit> buildASTFromCodeWithArgs( @@ -510,7 +513,7 @@ std::unique_ptr<ASTUnit> buildASTFromCod llvm::IntrusiveRefCntPtr<FileManager> Files( new FileManager(FileSystemOptions(), OverlayFileSystem)); ToolInvocation Invocation(getSyntaxOnlyToolArgs(ToolName, Args, FileNameRef), - &Action, Files.get(), PCHContainerOps); + &Action, Files.get(), std::move(PCHContainerOps)); SmallString<1024> CodeStorage; InMemoryFileSystem->addFile(FileNameRef, 0, _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits