[Lldb-commits] [PATCH] D122946: Prevent HostInfoBase::GetAugmentedArchSpec() from attaching "unknown" environments
Adrian Prantl via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 1 16:27:43 PDT 2022
aprantl created this revision.
aprantl added reviewers: JDevlieghere, jasonmolenda.
Herald added a project: All.
aprantl requested review of this revision.
Messy stuff. Environments are optional and a missing environment is distinct from the default "unknown" environment enumerator.
Also the test sucks, because the function uses the host triple and is unpredictable.
rdar://91007207
https://reviews.llvm.org/D122946
Files:
lldb/source/Host/common/HostInfoBase.cpp
lldb/unittests/Host/HostInfoTest.cpp
Index: lldb/unittests/Host/HostInfoTest.cpp
===================================================================
--- lldb/unittests/Host/HostInfoTest.cpp
+++ lldb/unittests/Host/HostInfoTest.cpp
@@ -43,6 +43,9 @@
// Test LLDB_ARCH_DEFAULT
EXPECT_EQ(HostInfo::GetAugmentedArchSpec(LLDB_ARCH_DEFAULT).GetTriple(),
HostInfo::GetArchitecture(HostInfo::eArchKindDefault).GetTriple());
+ EXPECT_NE(
+ HostInfo::GetAugmentedArchSpec("armv7k").GetTriple().getEnvironmentName(),
+ "unknown");
}
TEST_F(HostInfoTest, GetHostname) {
Index: lldb/source/Host/common/HostInfoBase.cpp
===================================================================
--- lldb/source/Host/common/HostInfoBase.cpp
+++ lldb/source/Host/common/HostInfoBase.cpp
@@ -209,7 +209,8 @@
normalized_triple.setVendor(host_triple.getVendor());
if (normalized_triple.getOSName().empty())
normalized_triple.setOS(host_triple.getOS());
- if (normalized_triple.getEnvironmentName().empty())
+ if (normalized_triple.getEnvironmentName().empty() &&
+ !host_triple.getEnvironmentName().empty())
normalized_triple.setEnvironment(host_triple.getEnvironment());
return ArchSpec(normalized_triple);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122946.419886.patch
Type: text/x-patch
Size: 1210 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220401/357e53fd/attachment.bin>
More information about the lldb-commits
mailing list