r302855 - [tooling] RefactoringCallbacks code cleanup

Alexander Shaposhnikov via cfe-commits cfe-commits at lists.llvm.org
Thu May 11 17:16:56 PDT 2017


Author: alexshap
Date: Thu May 11 19:16:56 2017
New Revision: 302855

URL: http://llvm.org/viewvc/llvm-project?rev=302855&view=rev
Log:
[tooling] RefactoringCallbacks code cleanup

This diff
 1. adds missing "explicit" for single argument constructors
 2. adds missing std::move in ReplaceNodeWithTemplate constructor

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D33061

Modified:
    cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h
    cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp

Modified: cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h?rev=302855&r1=302854&r2=302855&view=diff
==============================================================================
--- cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h (original)
+++ cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h Thu May 11 19:16:56 2017
@@ -53,7 +53,8 @@ protected:
 /// Runs AST matchers and stores the \c tooling::Replacements in a map.
 class ASTMatchRefactorer {
 public:
-  ASTMatchRefactorer(std::map<std::string, Replacements> &FileToReplaces);
+  explicit ASTMatchRefactorer(
+    std::map<std::string, Replacements> &FileToReplaces);
 
   template <typename T>
   void addMatcher(const T &Matcher, RefactoringCallback *Callback) {
@@ -103,7 +104,7 @@ private:
     std::string Value;
   };
   ReplaceNodeWithTemplate(llvm::StringRef FromId,
-                          std::vector<TemplateElement> &&Template);
+                          std::vector<TemplateElement> Template);
   std::string FromId;
   std::vector<TemplateElement> Template;
 };

Modified: cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp?rev=302855&r1=302854&r2=302855&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp (original)
+++ cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp Thu May 11 19:16:56 2017
@@ -38,7 +38,7 @@ void ASTMatchRefactorer::addDynamicMatch
 
 class RefactoringASTConsumer : public ASTConsumer {
 public:
-  RefactoringASTConsumer(ASTMatchRefactorer &Refactoring)
+  explicit RefactoringASTConsumer(ASTMatchRefactorer &Refactoring)
       : Refactoring(Refactoring) {}
 
   void HandleTranslationUnit(ASTContext &Context) override {
@@ -153,8 +153,8 @@ void ReplaceIfStmtWithItsBody::run(
 }
 
 ReplaceNodeWithTemplate::ReplaceNodeWithTemplate(
-    llvm::StringRef FromId, std::vector<TemplateElement> &&Template)
-    : FromId(FromId), Template(Template) {}
+    llvm::StringRef FromId, std::vector<TemplateElement> Template)
+    : FromId(FromId), Template(std::move(Template)) {}
 
 llvm::Expected<std::unique_ptr<ReplaceNodeWithTemplate>>
 ReplaceNodeWithTemplate::create(StringRef FromId, StringRef ToTemplate) {




More information about the cfe-commits mailing list