Skip to content

Commit 7850acd

Browse files
Merge pull request #4163 from adrian-prantl/91007207-1
Prevent GetAugmentedArchSpec() from attaching "unknown" environments
2 parents deab631 + 2b14a6f commit 7850acd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lldb/source/Host/common/HostInfoBase.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ ArchSpec HostInfoBase::GetAugmentedArchSpec(llvm::StringRef triple) {
205205
normalized_triple.setVendor(host_triple.getVendor());
206206
if (normalized_triple.getOSName().empty())
207207
normalized_triple.setOS(host_triple.getOS());
208-
if (normalized_triple.getEnvironmentName().empty())
208+
if (normalized_triple.getEnvironmentName().empty() &&
209+
!host_triple.getEnvironmentName().empty())
209210
normalized_triple.setEnvironment(host_triple.getEnvironment());
210211
return ArchSpec(normalized_triple);
211212
}

lldb/unittests/Host/HostInfoTest.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ TEST_F(HostInfoTest, GetAugmentedArchSpec) {
4343
// Test LLDB_ARCH_DEFAULT
4444
EXPECT_EQ(HostInfo::GetAugmentedArchSpec(LLDB_ARCH_DEFAULT).GetTriple(),
4545
HostInfo::GetArchitecture(HostInfo::eArchKindDefault).GetTriple());
46+
EXPECT_NE(
47+
HostInfo::GetAugmentedArchSpec("armv7k").GetTriple().getEnvironmentName(),
48+
"unknown");
4649
}
4750

4851
TEST_F(HostInfoTest, GetHostname) {

0 commit comments

Comments
 (0)