[clang] 59f8e75 - [clang][driver][darwin] Tweak the use after scope fix in Darwin driver toolchain (#178981)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 30 16:06:43 PST 2026
Author: Ian Anderson
Date: 2026-01-30T16:06:39-08:00
New Revision: 59f8e756d8a662312de80d0343cba486c86902ab
URL: https://github.com/llvm/llvm-project/commit/59f8e756d8a662312de80d0343cba486c86902ab
DIFF: https://github.com/llvm/llvm-project/commit/59f8e756d8a662312de80d0343cba486c86902ab.diff
LOG: [clang][driver][darwin] Tweak the use after scope fix in Darwin driver toolchain (#178981)
It's ever so slightly cleaner looking and less error prone to make the
SmallVector hold std::string instead of making a local just for the
version string.
Added:
Modified:
clang/lib/Driver/ToolChains/Darwin.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 0a3b9ca1aeecb..e7b41830feb7e 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -2043,7 +2043,7 @@ struct DarwinPlatform {
static std::string getDisplayName(DarwinPlatformKind TargetPlatform,
DarwinEnvironmentKind TargetEnvironment,
VersionTuple Version) {
- SmallVector<StringRef, 3> Components;
+ SmallVector<std::string, 3> Components;
switch (TargetPlatform) {
case DarwinPlatformKind::MacOS:
Components.push_back("macOS");
@@ -2076,8 +2076,7 @@ struct DarwinPlatform {
std::to_string(TargetEnvironment) +
"' is unsupported when inferring SDK Info.");
}
- std::string VersionString = Version.getAsString();
- Components.push_back(VersionString);
+ Components.push_back(Version.getAsString());
return join(Components, " ");
}
More information about the cfe-commits
mailing list