r271182 - Avoid unnecessary std::string copies. NFC.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Sun May 29 04:05:04 PDT 2016


Author: d0k
Date: Sun May 29 06:04:56 2016
New Revision: 271182

URL: http://llvm.org/viewvc/llvm-project?rev=271182&view=rev
Log:
Avoid unnecessary std::string copies. NFC.

Modified:
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
    cfe/trunk/lib/Tooling/Refactoring.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=271182&r1=271181&r2=271182&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sun May 29 06:04:56 2016
@@ -400,7 +400,7 @@ static void setPGOInstrumentor(CodeGenOp
 
 // Set the profile kind using fprofile-instrument-use-path.
 static void setPGOUseInstrumentor(CodeGenOptions &Opts,
-                                  const std::string ProfileName) {
+                                  const Twine &ProfileName) {
   auto ReaderOrErr = llvm::IndexedInstrProfReader::create(ProfileName);
   // In error, return silently and let Clang PGOUse report the error message.
   if (auto E = ReaderOrErr.takeError()) {

Modified: cfe/trunk/lib/Tooling/Refactoring.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Refactoring.cpp?rev=271182&r1=271181&r2=271182&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/Refactoring.cpp (original)
+++ cfe/trunk/lib/Tooling/Refactoring.cpp Sun May 29 06:04:56 2016
@@ -70,8 +70,8 @@ bool formatAndApplyAllReplacements(const
   auto FileToReplaces = groupReplacementsByFile(Replaces);
 
   bool Result = true;
-  for (auto &FileAndReplaces : FileToReplaces) {
-    const std::string FilePath = FileAndReplaces.first;
+  for (const auto &FileAndReplaces : FileToReplaces) {
+    const std::string &FilePath = FileAndReplaces.first;
     auto &CurReplaces = FileAndReplaces.second;
 
     const FileEntry *Entry = Files.getFile(FilePath);




More information about the cfe-commits mailing list