Author: d0k Date: Tue Mar 21 16:35:04 2017 New Revision: 298443 URL: http://llvm.org/viewvc/llvm-project?rev=298443&view=rev Log: Apply clang-tidy's performance-unnecessary-value-param to parts of clang.
No functionality change intended. Modified: cfe/trunk/include/clang/Driver/ToolChain.h cfe/trunk/include/clang/Serialization/ASTReader.h cfe/trunk/lib/AST/ExprConstant.cpp cfe/trunk/lib/Basic/FileManager.cpp cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/lib/Serialization/GeneratePCH.cpp cfe/trunk/lib/Tooling/Refactoring.cpp cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp Modified: cfe/trunk/include/clang/Driver/ToolChain.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=298443&r1=298442&r2=298443&view=diff ============================================================================== --- cfe/trunk/include/clang/Driver/ToolChain.h (original) +++ cfe/trunk/include/clang/Driver/ToolChain.h Tue Mar 21 16:35:04 2017 @@ -99,7 +99,9 @@ private: mutable llvm::Triple EffectiveTriple; /// Set the toolchain's effective clang triple. - void setEffectiveTriple(llvm::Triple ET) const { EffectiveTriple = ET; } + void setEffectiveTriple(llvm::Triple ET) const { + EffectiveTriple = std::move(ET); + } friend class RegisterEffectiveTriple; @@ -476,7 +478,7 @@ class RegisterEffectiveTriple { public: RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T) : TC(TC) { - TC.setEffectiveTriple(T); + TC.setEffectiveTriple(std::move(T)); } ~RegisterEffectiveTriple() { TC.setEffectiveTriple(llvm::Triple()); } Modified: cfe/trunk/include/clang/Serialization/ASTReader.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=298443&r1=298442&r2=298443&view=diff ============================================================================== --- cfe/trunk/include/clang/Serialization/ASTReader.h (original) +++ cfe/trunk/include/clang/Serialization/ASTReader.h Tue Mar 21 16:35:04 2017 @@ -1585,7 +1585,7 @@ public: const LangOptions &LangOpts, const TargetOptions &TargetOpts, const PreprocessorOptions &PPOpts, - std::string ExistingModuleCachePath); + StringRef ExistingModuleCachePath); /// \brief Returns the suggested contents of the predefines buffer, /// which contains a (typically-empty) subset of the predefines Modified: cfe/trunk/lib/AST/ExprConstant.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=298443&r1=298442&r2=298443&view=diff ============================================================================== --- cfe/trunk/lib/AST/ExprConstant.cpp (original) +++ cfe/trunk/lib/AST/ExprConstant.cpp Tue Mar 21 16:35:04 2017 @@ -350,7 +350,8 @@ namespace { MostDerivedArraySize = 2; MostDerivedPathLength = Entries.size(); } - void diagnosePointerArithmetic(EvalInfo &Info, const Expr *E, APSInt N); + void diagnosePointerArithmetic(EvalInfo &Info, const Expr *E, + const APSInt &N); /// Add N to the address of this subobject. void adjustIndex(EvalInfo &Info, const Expr *E, APSInt N) { if (Invalid || !N) return; @@ -1071,7 +1072,8 @@ bool SubobjectDesignator::checkSubobject } void SubobjectDesignator::diagnosePointerArithmetic(EvalInfo &Info, - const Expr *E, APSInt N) { + const Expr *E, + const APSInt &N) { // If we're complaining, we must be able to statically determine the size of // the most derived array. if (MostDerivedPathLength == Entries.size() && MostDerivedIsArrayElement) @@ -1296,8 +1298,8 @@ namespace { void clearIsNullPointer() { IsNullPtr = false; } - void adjustOffsetAndIndex(EvalInfo &Info, const Expr *E, APSInt Index, - CharUnits ElementSize) { + void adjustOffsetAndIndex(EvalInfo &Info, const Expr *E, + const APSInt &Index, CharUnits ElementSize) { // An index of 0 has no effect. (In C, adding 0 to a null pointer is UB, // but we're not required to diagnose it and it's valid in C++.) if (!Index) @@ -8072,7 +8074,8 @@ bool DataRecursiveIntBinOpEvaluator:: return true; } -static void addOrSubLValueAsInteger(APValue &LVal, APSInt Index, bool IsSub) { +static void addOrSubLValueAsInteger(APValue &LVal, const APSInt &Index, + bool IsSub) { // Compute the new offset in the appropriate width, wrapping at 64 bits. // FIXME: When compiling for a 32-bit target, we should use 32-bit // offsets. Modified: cfe/trunk/lib/Basic/FileManager.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=298443&r1=298442&r2=298443&view=diff ============================================================================== --- cfe/trunk/lib/Basic/FileManager.cpp (original) +++ cfe/trunk/lib/Basic/FileManager.cpp Tue Mar 21 16:35:04 2017 @@ -50,14 +50,14 @@ using namespace clang; FileManager::FileManager(const FileSystemOptions &FSO, IntrusiveRefCntPtr<vfs::FileSystem> FS) - : FS(FS), FileSystemOpts(FSO), - SeenDirEntries(64), SeenFileEntries(64), NextFileUID(0) { + : FS(std::move(FS)), FileSystemOpts(FSO), SeenDirEntries(64), + SeenFileEntries(64), NextFileUID(0) { NumDirLookups = NumFileLookups = 0; NumDirCacheMisses = NumFileCacheMisses = 0; // If the caller doesn't provide a virtual file system, just grab the real // file system. - if (!FS) + if (!this->FS) this->FS = vfs::getRealFileSystem(); } Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=298443&r1=298442&r2=298443&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Tue Mar 21 16:35:04 2017 @@ -953,7 +953,7 @@ static void runThinLTOBackend(ModuleSumm return llvm::make_unique<lto::NativeObjectStream>(std::move(OS)); }; lto::Config Conf; - Conf.SampleProfile = SampleProfile; + Conf.SampleProfile = std::move(SampleProfile); if (Error E = thinBackend( Conf, 0, AddStream, *M, *CombinedIndex, ImportList, ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) { Modified: cfe/trunk/lib/Serialization/ASTReader.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=298443&r1=298442&r2=298443&view=diff ============================================================================== --- cfe/trunk/lib/Serialization/ASTReader.cpp (original) +++ cfe/trunk/lib/Serialization/ASTReader.cpp Tue Mar 21 16:35:04 2017 @@ -4732,11 +4732,12 @@ bool ASTReader::readASTFileControlBlock( return false; } -bool ASTReader::isAcceptableASTFile( - StringRef Filename, FileManager &FileMgr, - const PCHContainerReader &PCHContainerRdr, const LangOptions &LangOpts, - const TargetOptions &TargetOpts, const PreprocessorOptions &PPOpts, - std::string ExistingModuleCachePath) { +bool ASTReader::isAcceptableASTFile(StringRef Filename, FileManager &FileMgr, + const PCHContainerReader &PCHContainerRdr, + const LangOptions &LangOpts, + const TargetOptions &TargetOpts, + const PreprocessorOptions &PPOpts, + StringRef ExistingModuleCachePath) { SimplePCHValidator validator(LangOpts, TargetOpts, PPOpts, ExistingModuleCachePath, FileMgr); return !readASTFileControlBlock(Filename, FileMgr, PCHContainerRdr, Modified: cfe/trunk/lib/Serialization/GeneratePCH.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/GeneratePCH.cpp?rev=298443&r1=298442&r2=298443&view=diff ============================================================================== --- cfe/trunk/lib/Serialization/GeneratePCH.cpp (original) +++ cfe/trunk/lib/Serialization/GeneratePCH.cpp Tue Mar 21 16:35:04 2017 @@ -27,11 +27,11 @@ PCHGenerator::PCHGenerator( ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions, bool AllowASTWithErrors, bool IncludeTimestamps) : PP(PP), OutputFile(OutputFile), isysroot(isysroot.str()), - SemaPtr(nullptr), Buffer(Buffer), Stream(Buffer->Data), - Writer(Stream, Buffer->Data, PP.getPCMCache(), Extensions, + SemaPtr(nullptr), Buffer(std::move(Buffer)), Stream(this->Buffer->Data), + Writer(Stream, this->Buffer->Data, PP.getPCMCache(), Extensions, IncludeTimestamps), AllowASTWithErrors(AllowASTWithErrors) { - Buffer->IsComplete = false; + this->Buffer->IsComplete = false; } PCHGenerator::~PCHGenerator() { Modified: cfe/trunk/lib/Tooling/Refactoring.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Refactoring.cpp?rev=298443&r1=298442&r2=298443&view=diff ============================================================================== --- cfe/trunk/lib/Tooling/Refactoring.cpp (original) +++ cfe/trunk/lib/Tooling/Refactoring.cpp Tue Mar 21 16:35:04 2017 @@ -28,7 +28,7 @@ namespace tooling { RefactoringTool::RefactoringTool( const CompilationDatabase &Compilations, ArrayRef<std::string> SourcePaths, std::shared_ptr<PCHContainerOperations> PCHContainerOps) - : ClangTool(Compilations, SourcePaths, PCHContainerOps) {} + : ClangTool(Compilations, SourcePaths, std::move(PCHContainerOps)) {} std::map<std::string, Replacements> &RefactoringTool::getReplacements() { return FileToReplaces; Modified: cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp?rev=298443&r1=298442&r2=298443&view=diff ============================================================================== --- cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp (original) +++ cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp Tue Mar 21 16:35:04 2017 @@ -320,7 +320,8 @@ AllocatedCXCodeCompleteResults::Allocate : CXCodeCompleteResults(), DiagOpts(new DiagnosticOptions), Diag(new DiagnosticsEngine( IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs), &*DiagOpts)), - FileMgr(FileMgr), SourceMgr(new SourceManager(*Diag, *FileMgr)), + FileMgr(std::move(FileMgr)), + SourceMgr(new SourceManager(*Diag, *this->FileMgr)), CodeCompletionAllocator( std::make_shared<clang::GlobalCodeCompletionAllocator>()), Contexts(CXCompletionContext_Unknown), _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits