Remove unnecessary std::string construction

llvm-svn: 295083
This commit is contained in:
Reid Kleckner 2017-02-14 18:38:40 +00:00
parent 2a02c2e331
commit 273895bbc9
1 changed files with 2 additions and 3 deletions

View File

@ -1983,14 +1983,13 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
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);
}
}