Skip to content

Commit 8511436

Browse files
[Frontend] Use SmallString::operator std::string (NFC)
1 parent aa530c7 commit 8511436

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

clang/lib/Frontend/CompilerInstance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ std::string CompilerInstance::getSpecificModuleCachePath(StringRef ModuleHash) {
543543
SmallString<256> SpecificModuleCache(getHeaderSearchOpts().ModuleCachePath);
544544
if (!SpecificModuleCache.empty() && !getHeaderSearchOpts().DisableModuleHash)
545545
llvm::sys::path::append(SpecificModuleCache, ModuleHash);
546-
return std::string(SpecificModuleCache.str());
546+
return std::string(SpecificModuleCache);
547547
}
548548

549549
// ASTContext

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3176,7 +3176,7 @@ static bool ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
31763176
llvm::sys::fs::make_absolute(WorkingDir, P);
31773177
}
31783178
llvm::sys::path::remove_dots(P);
3179-
Opts.ModuleCachePath = std::string(P.str());
3179+
Opts.ModuleCachePath = std::string(P);
31803180

31813181
// Only the -fmodule-file=<name>=<file> form.
31823182
for (const auto *A : Args.filtered(OPT_fmodule_file)) {
@@ -3217,7 +3217,7 @@ static bool ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
32173217
SmallString<32> Buffer;
32183218
llvm::sys::path::append(Buffer, Opts.Sysroot,
32193219
llvm::StringRef(A->getValue()).substr(1));
3220-
Path = std::string(Buffer.str());
3220+
Path = std::string(Buffer);
32213221
}
32223222

32233223
Opts.AddPath(Path, Group, IsFramework,

clang/lib/Frontend/LogDiagnosticPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void LogDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
134134
// Format the message.
135135
SmallString<100> MessageStr;
136136
Info.FormatDiagnostic(MessageStr);
137-
DE.Message = std::string(MessageStr.str());
137+
DE.Message = std::string(MessageStr);
138138

139139
// Set the location information.
140140
DE.Filename = "";

clang/lib/Frontend/Rewrite/FrontendActions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class FixItRewriteToTemp : public FixItOptions {
8888
llvm::sys::fs::createTemporaryFile(llvm::sys::path::filename(Filename),
8989
llvm::sys::path::extension(Filename).drop_front(), fd,
9090
Path);
91-
return std::string(Path.str());
91+
return std::string(Path);
9292
}
9393
};
9494
} // end anonymous namespace

clang/lib/Frontend/TextDiagnosticBuffer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ void TextDiagnosticBuffer::HandleDiagnostic(DiagnosticsEngine::Level Level,
3232
"Diagnostic not handled during diagnostic buffering!");
3333
case DiagnosticsEngine::Note:
3434
All.emplace_back(Level, Notes.size());
35-
Notes.emplace_back(Info.getLocation(), std::string(Buf.str()));
35+
Notes.emplace_back(Info.getLocation(), std::string(Buf));
3636
break;
3737
case DiagnosticsEngine::Warning:
3838
All.emplace_back(Level, Warnings.size());
39-
Warnings.emplace_back(Info.getLocation(), std::string(Buf.str()));
39+
Warnings.emplace_back(Info.getLocation(), std::string(Buf));
4040
break;
4141
case DiagnosticsEngine::Remark:
4242
All.emplace_back(Level, Remarks.size());
43-
Remarks.emplace_back(Info.getLocation(), std::string(Buf.str()));
43+
Remarks.emplace_back(Info.getLocation(), std::string(Buf));
4444
break;
4545
case DiagnosticsEngine::Error:
4646
case DiagnosticsEngine::Fatal:
4747
All.emplace_back(Level, Errors.size());
48-
Errors.emplace_back(Info.getLocation(), std::string(Buf.str()));
48+
Errors.emplace_back(Info.getLocation(), std::string(Buf));
4949
break;
5050
}
5151
}

0 commit comments

Comments
 (0)