[Lldb-commits] [PATCH] D122946: Prevent HostInfoBase::GetAugmentedArchSpec() from attaching "unknown" environments

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 4 08:57:18 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGcf3e4011b57b: Prevent GetAugmentedArchSpec() from attaching "unknown" environments (authored by aprantl).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122946/new/

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.420198.patch
Type: text/x-patch
Size: 1210 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220404/32341565/attachment.bin>


More information about the lldb-commits mailing list