[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

llvm-svn: 302855
This commit is contained in:
Alexander Shaposhnikov 2017-05-12 00:16:56 +00:00
parent f70ee60e07
commit 6e0bc3fce4
2 changed files with 6 additions and 5 deletions

View File

@ -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;
};

View File

@ -38,7 +38,7 @@ void ASTMatchRefactorer::addDynamicMatcher(
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) {