[Lldb-commits] [PATCH] D112676: [lldb] The os and version are not separate components in the triple

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 27 16:36:13 PDT 2021


JDevlieghere updated this revision to Diff 382851.
JDevlieghere added a comment.

Skip the environment if it's empty and avoid a TypeError when concatenating 'NoneType' and 'str'.


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

https://reviews.llvm.org/D112676

Files:
  lldb/packages/Python/lldbsuite/test/builders/darwin.py


Index: lldb/packages/Python/lldbsuite/test/builders/darwin.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/builders/darwin.py
+++ lldb/packages/Python/lldbsuite/test/builders/darwin.py
@@ -54,13 +54,20 @@
     return vendor, os, version, env
 
 
+def get_triple_str(arch, vendor, os, version, env):
+    if None in [arch, vendor, os, version, env]:
+        return None
+
+    component = [arch, vendor, os + version]
+    if env:
+        components.append(env)
+    return '-'.join(component)
+
+
 class BuilderDarwin(Builder):
     def getTriple(self, arch):
         vendor, os, version, env = get_triple()
-        components = [arch, vendor, os, version, env]
-        if None in components:
-            return None
-        return '-'.join(components)
+        return get_triple_str(arch, vendor, os, version, env)
 
     def getExtraMakeArgs(self):
         """
@@ -93,12 +100,10 @@
         """Returns the ARCH_CFLAGS for the make system."""
         # Get the triple components.
         vendor, os, version, env = get_triple()
-        if vendor is None or os is None or version is None or env is None:
+        triple = get_triple_str(arch, vendor, os, version, env)
+        if not triple:
             return []
 
-        # Construct the triple from its components.
-        triple = '-'.join([arch, vendor, os, version, env])
-
         # Construct min version argument
         version_min = ""
         if env == "simulator":


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112676.382851.patch
Type: text/x-patch
Size: 1508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211027/71f487ca/attachment-0001.bin>


More information about the lldb-commits mailing list