Skip to content

Commit 73f5957

Browse files
kazutakahirataJaddyen
authored andcommitted
[BOLT] Avoid creating a temporary instance of std::string (NFC) (llvm#140987)
lookupTarget takes StringRef and internally creates an instance of std::string with the StringRef as part of constructing Triple, so we don't need to create a temporary instance of std::string on our own.
1 parent 98b461f commit 73f5957

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bolt/lib/Core/BinaryContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext(
201201

202202
std::string Error;
203203
const Target *TheTarget =
204-
TargetRegistry::lookupTarget(std::string(ArchName), TheTriple, Error);
204+
TargetRegistry::lookupTarget(ArchName, TheTriple, Error);
205205
if (!TheTarget)
206206
return createStringError(make_error_code(std::errc::not_supported),
207207
Twine("BOLT-ERROR: ", Error));

0 commit comments

Comments
 (0)