r295083 - Remove unnecessary std::string construction

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 14 10:38:41 PST 2017


Author: rnk
Date: Tue Feb 14 12:38:40 2017
New Revision: 295083

URL: http://llvm.org/viewvc/llvm-project?rev=295083&view=rev
Log:
Remove unnecessary std::string construction

Modified:
    cfe/trunk/lib/Lex/PPDirectives.cpp

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=295083&r1=295082&r2=295083&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Tue Feb 14 12:38:40 2017
@@ -1983,14 +1983,13 @@ void Preprocessor::HandleIncludeDirectiv
           Path.size() <= Filename.size() ? Filename[Path.size()-1] :
             (isAngled ? '>' : '"'));
       }
-      auto Replacement = Path.str().str();
       // For user files and known standard headers, by default we issue a diagnostic.
       // For other system headers, we don't. They can be controlled separately.
       auto DiagId = (FileCharacter == SrcMgr::C_User || warnByDefaultOnWrongCase(Name)) ?
           diag::pp_nonportable_path : diag::pp_nonportable_system_path;
       SourceRange Range(FilenameTok.getLocation(), CharEnd);
-      Diag(FilenameTok, DiagId) << Replacement <<
-        FixItHint::CreateReplacement(Range, Replacement);
+      Diag(FilenameTok, DiagId) << Path <<
+        FixItHint::CreateReplacement(Range, Path);
     }
   }
 




More information about the cfe-commits mailing list