diff options
Diffstat (limited to 'clang-tools-extra')
6 files changed, 17 insertions, 14 deletions
diff --git a/clang-tools-extra/clang-modernize/LoopConvert/StmtAncestor.h b/clang-tools-extra/clang-modernize/LoopConvert/StmtAncestor.h index fae4d131347..e2ee2b9fd4e 100644 --- a/clang-tools-extra/clang-modernize/LoopConvert/StmtAncestor.h +++ b/clang-tools-extra/clang-modernize/LoopConvert/StmtAncestor.h @@ -170,9 +170,9 @@ private: class DeclFinderASTVisitor : public clang::RecursiveASTVisitor<DeclFinderASTVisitor> { public: - DeclFinderASTVisitor(std::string Name, - const StmtGeneratedVarNameMap *GeneratedDecls) - : Name(std::move(Name)), GeneratedDecls(GeneratedDecls), Found(false) {} + DeclFinderASTVisitor(const std::string &Name, + const StmtGeneratedVarNameMap *GeneratedDecls) : + Name(Name), GeneratedDecls(GeneratedDecls), Found(false) { } /// Attempts to find any usages of variables name Name in Body, returning /// true when it is used in Body. This includes the generated loop variables diff --git a/clang-tools-extra/clang-rename/RenamingAction.cpp b/clang-tools-extra/clang-rename/RenamingAction.cpp index 98cdc14b75d..0c2307b9653 100644 --- a/clang-tools-extra/clang-rename/RenamingAction.cpp +++ b/clang-tools-extra/clang-rename/RenamingAction.cpp @@ -37,11 +37,14 @@ namespace rename { class RenamingASTConsumer : public ASTConsumer { public: - RenamingASTConsumer(StringRef NewName, StringRef PrevName, + RenamingASTConsumer(const std::string &NewName, + const std::string &PrevName, const std::vector<std::string> &USRs, - tooling::Replacements &Replaces, bool PrintLocations) + tooling::Replacements &Replaces, + bool PrintLocations) : NewName(NewName), PrevName(PrevName), USRs(USRs), Replaces(Replaces), - PrintLocations(PrintLocations) {} + PrintLocations(PrintLocations) { + } void HandleTranslationUnit(ASTContext &Context) override { const auto &SourceMgr = Context.getSourceManager(); @@ -55,7 +58,7 @@ public: NewCandidates.clear(); } - auto PrevNameLen = PrevName.size(); + auto PrevNameLen = PrevName.length(); if (PrintLocations) for (const auto &Loc : RenamingCandidates) { FullSourceLoc FullLoc(Loc, SourceMgr); @@ -72,7 +75,7 @@ public: } private: - StringRef NewName, PrevName; + const std::string &NewName, &PrevName; const std::vector<std::string> &USRs; tooling::Replacements &Replaces; bool PrintLocations; diff --git a/clang-tools-extra/clang-rename/RenamingAction.h b/clang-tools-extra/clang-rename/RenamingAction.h index 68fe331daf0..d52f21d7c23 100644 --- a/clang-tools-extra/clang-rename/RenamingAction.h +++ b/clang-tools-extra/clang-rename/RenamingAction.h @@ -25,7 +25,7 @@ namespace rename { class RenamingAction { public: - RenamingAction(llvm::StringRef NewName, llvm::StringRef PrevName, + RenamingAction(const std::string &NewName, const std::string &PrevName, const std::vector<std::string> &USRs, tooling::Replacements &Replaces, bool PrintLocations = false) : NewName(NewName), PrevName(PrevName), USRs(USRs), Replaces(Replaces), @@ -35,7 +35,7 @@ public: std::unique_ptr<ASTConsumer> newASTConsumer(); private: - llvm::StringRef NewName, PrevName; + const std::string &NewName, &PrevName; const std::vector<std::string> &USRs; tooling::Replacements &Replaces; bool PrintLocations; diff --git a/clang-tools-extra/modularize/Modularize.cpp b/clang-tools-extra/modularize/Modularize.cpp index 4acfe72b42e..a309ecd3286 100644 --- a/clang-tools-extra/modularize/Modularize.cpp +++ b/clang-tools-extra/modularize/Modularize.cpp @@ -466,9 +466,9 @@ class EntityMap : public StringMap<SmallVector<Entry, 2> > { public: DenseMap<const FileEntry *, HeaderContents> HeaderContentMismatches; - void add(StringRef Name, enum Entry::EntryKind Kind, Location Loc) { + void add(const std::string &Name, enum Entry::EntryKind Kind, Location Loc) { // Record this entity in its header. - HeaderEntry HE = {Name.str(), Loc}; + HeaderEntry HE = { Name, Loc }; CurHeaderContents[Loc.File].push_back(HE); // Check whether we've seen this entry before. diff --git a/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp b/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp index e4211b3b94b..8a3705495ad 100644 --- a/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp +++ b/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp @@ -627,7 +627,7 @@ void PPCallbacksTracker::appendArgument(const char *Name, // Append a double-quoted argument to the top trace item. void PPCallbacksTracker::appendQuotedArgument(const char *Name, - llvm::StringRef Value) { + const std::string &Value) { std::string Str; llvm::raw_string_ostream SS(Str); SS << "\"" << Value << "\""; diff --git a/clang-tools-extra/pp-trace/PPCallbacksTracker.h b/clang-tools-extra/pp-trace/PPCallbacksTracker.h index 475e3bd4330..8c2e6bb55d2 100644 --- a/clang-tools-extra/pp-trace/PPCallbacksTracker.h +++ b/clang-tools-extra/pp-trace/PPCallbacksTracker.h @@ -215,7 +215,7 @@ public: void appendArgument(const char *Name, const clang::Module *Value); /// \brief Append a double-quoted argument to the top trace item. - void appendQuotedArgument(const char *Name, llvm::StringRef Value); + void appendQuotedArgument(const char *Name, const std::string &Value); /// \brief Append a double-quoted file path argument to the top trace item. void appendFilePathArgument(const char *Name, llvm::StringRef Value); |