Hi.

Thanks for your feedback. I fixed the regression. Here is the new patch.

26.06.2015, 00:51, "Yaron Keren" <yaron.ke...@gmail.com>:
> Hi Eugene,
>
> This patch does not pass clang extra tools regression tests locally,
>
> FAIL: Clang Tools :: modularize/NoProblems.modularize (7141 of 19860)
> Testing: 0 .. 10.. 20.. 30
> FAIL: Clang Tools :: modularize/NoProblemsDependencies.modularize (7144 of 
> 19860)
> Testing: 0 .. 10.. 20.. 30
> FAIL: Clang Tools :: modularize/NoProblemsCoverage.modularize (7145 of 19860)
> (...)
>
> Please check it out.
>
> Yaron
>
> 2015-06-22 15:25 GMT+03:00 Eugene Kosov <clap...@yandex.ru>:
>> Hi.
>>
>> Here are two patches for clang-tools-extra and for clang which simplifies 
>> code a little bit and also removes possibility of implicit std::string 
>> construction.
>>
>> --
>> Eugene
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

--
Eugene
diff --git a/clang-modernize/LoopConvert/StmtAncestor.h b/clang-modernize/LoopConvert/StmtAncestor.h
index e2ee2b9..fae4d13 100644
--- a/clang-modernize/LoopConvert/StmtAncestor.h
+++ b/clang-modernize/LoopConvert/StmtAncestor.h
@@ -170,9 +170,9 @@ private:
 class DeclFinderASTVisitor :
   public clang::RecursiveASTVisitor<DeclFinderASTVisitor> {
 public:
-  DeclFinderASTVisitor(const std::string &Name,
-                       const StmtGeneratedVarNameMap *GeneratedDecls) :
-    Name(Name), GeneratedDecls(GeneratedDecls), Found(false) { }
+  DeclFinderASTVisitor(std::string Name,
+                       const StmtGeneratedVarNameMap *GeneratedDecls)
+      : Name(std::move(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-rename/RenamingAction.cpp b/clang-rename/RenamingAction.cpp
index 0c2307b..98cdc14 100644
--- a/clang-rename/RenamingAction.cpp
+++ b/clang-rename/RenamingAction.cpp
@@ -37,14 +37,11 @@ namespace rename {
 
 class RenamingASTConsumer : public ASTConsumer {
 public:
-  RenamingASTConsumer(const std::string &NewName,
-                      const std::string &PrevName,
+  RenamingASTConsumer(StringRef NewName, StringRef 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();
@@ -58,7 +55,7 @@ public:
       NewCandidates.clear();
     }
 
-    auto PrevNameLen = PrevName.length();
+    auto PrevNameLen = PrevName.size();
     if (PrintLocations)
       for (const auto &Loc : RenamingCandidates) {
         FullSourceLoc FullLoc(Loc, SourceMgr);
@@ -75,7 +72,7 @@ public:
   }
 
 private:
-  const std::string &NewName, &PrevName;
+  StringRef NewName, PrevName;
   const std::vector<std::string> &USRs;
   tooling::Replacements &Replaces;
   bool PrintLocations;
diff --git a/clang-rename/RenamingAction.h b/clang-rename/RenamingAction.h
index d52f21d..68fe331 100644
--- a/clang-rename/RenamingAction.h
+++ b/clang-rename/RenamingAction.h
@@ -25,7 +25,7 @@ namespace rename {
 
 class RenamingAction {
 public:
-  RenamingAction(const std::string &NewName, const std::string &PrevName,
+  RenamingAction(llvm::StringRef NewName, llvm::StringRef 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:
-  const std::string &NewName, &PrevName;
+  llvm::StringRef NewName, PrevName;
   const std::vector<std::string> &USRs;
   tooling::Replacements &Replaces;
   bool PrintLocations;
diff --git a/modularize/Modularize.cpp b/modularize/Modularize.cpp
index a309ecd..4acfe72 100644
--- a/modularize/Modularize.cpp
+++ b/modularize/Modularize.cpp
@@ -466,9 +466,9 @@ class EntityMap : public StringMap<SmallVector<Entry, 2> > {
 public:
   DenseMap<const FileEntry *, HeaderContents> HeaderContentMismatches;
 
-  void add(const std::string &Name, enum Entry::EntryKind Kind, Location Loc) {
+  void add(StringRef Name, enum Entry::EntryKind Kind, Location Loc) {
     // Record this entity in its header.
-    HeaderEntry HE = { Name, Loc };
+    HeaderEntry HE = {Name.str(), Loc};
     CurHeaderContents[Loc.File].push_back(HE);
 
     // Check whether we've seen this entry before.
diff --git a/pp-trace/PPCallbacksTracker.cpp b/pp-trace/PPCallbacksTracker.cpp
index 8a37054..e4211b3 100644
--- a/pp-trace/PPCallbacksTracker.cpp
+++ b/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,
-                                              const std::string &Value) {
+                                              llvm::StringRef Value) {
   std::string Str;
   llvm::raw_string_ostream SS(Str);
   SS << "\"" << Value << "\"";
diff --git a/pp-trace/PPCallbacksTracker.h b/pp-trace/PPCallbacksTracker.h
index 8c2e6bb..475e3bd 100644
--- a/pp-trace/PPCallbacksTracker.h
+++ b/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, const std::string &Value);
+  void appendQuotedArgument(const char *Name, llvm::StringRef Value);
 
   /// \brief Append a double-quoted file path argument to the top trace item.
   void appendFilePathArgument(const char *Name, llvm::StringRef Value);
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to