]> granicus.if.org Git - clang/commitdiff
Apply clang-tidy's performance-unnecessary-value-param to parts of clang.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 21 Mar 2017 21:35:04 +0000 (21:35 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 21 Mar 2017 21:35:04 +0000 (21:35 +0000)
No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298443 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/ToolChain.h
include/clang/Serialization/ASTReader.h
lib/AST/ExprConstant.cpp
lib/Basic/FileManager.cpp
lib/CodeGen/BackendUtil.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/GeneratePCH.cpp
lib/Tooling/Refactoring.cpp
tools/libclang/CIndexCodeCompletion.cpp

index 7dbe7a96dd5df2fb1f7aedd685882a91db3d6a46..f8e5fde2cd7400db932face40544ba9495e33078 100644 (file)
@@ -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()); }
index cdca2eebcf7b99bae9c02d6b4b937ab978b17573..238027f9788f69fb1a4b0a2580c8eb6f3bb0faf7 100644 (file)
@@ -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
index a1b508f78cd03cfa721941ead1b90217e1e9636b..2fafa48767584e852f76f36c03088a6b19973ea0 100644 (file)
@@ -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(EvalInfo &Info, const Expr *E,
 }
 
 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.
index 50050d0a519b57da276b4cb416aa4e1d8f4945ce..646c1910bf4e6a84533cb37a07cf7ccbf210b6c1 100644 (file)
@@ -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();
 }
 
index d1aae08cb57fc39098ee015d4c37f3074490bdd7..35c31a032024c809bfbcfb4ebda08bc0aa27fee9 100644 (file)
@@ -953,7 +953,7 @@ static void runThinLTOBackend(ModuleSummaryIndex *CombinedIndex, Module *M,
     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)) {
index eac08545b165d6357e70b097be8775448d8278b7..d9033c830a857f85f5a1490080791e364d5b6fcc 100644 (file)
@@ -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,
index 429ae8ebda59c5090646b5809ce937787f5c6bb0..2e0076521f9c0154f04cf4feaf5770ad12547508 100644 (file)
@@ -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() {
index 954a473f07ca0f0dcec0972d9a6796949ff64f41..db34c952d794527cff85302573a641c4510314b0 100644 (file)
@@ -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;
index ca68bc1cd28ee5f2e0317cf311cdc6a88807c2a0..f394a6dbee965fc74b0fb92dfe3f892be2797e52 100644 (file)
@@ -320,7 +320,8 @@ AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults(
     : 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),