[Lldb-commits] [lldb] 074c591 - [lldb] Add getExtraMakeArgs to Builder (NFC)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 19 09:47:46 PDT 2020


Author: Jonas Devlieghere
Date: 2020-08-19T09:47:25-07:00
New Revision: 074c591a7e9b366582dfc8dc127dd8df2ab1ac99

URL: https://github.com/llvm/llvm-project/commit/074c591a7e9b366582dfc8dc127dd8df2ab1ac99
DIFF: https://github.com/llvm/llvm-project/commit/074c591a7e9b366582dfc8dc127dd8df2ab1ac99.diff

LOG: [lldb] Add getExtraMakeArgs to Builder (NFC)

Instead of a new method for each variable any subclass might want to
set, have a method getExtraMakeArgs that each subclass can use to return
whatever extra Make arguments it wants.

As per Pavel's suggestion in D85539.

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/builders/builder.py
    lldb/packages/Python/lldbsuite/test/builders/darwin.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py
index 659e619e3d6a..160bafb95b56 100644
--- a/lldb/packages/Python/lldbsuite/test/builders/builder.py
+++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py
@@ -20,6 +20,13 @@ def getCompiler(self):
         compiler = lldbutil.which(compiler)
         return os.path.abspath(compiler)
 
+    def getExtraMakeArgs(self):
+        """
+        Helper function to return extra argumentsfor the make system. This
+        method is meant to be overridden by platform specific builders.
+        """
+        return ""
+
     def getMake(self, test_subdir, test_name):
         """Returns the invocation for GNU make.
         The first argument is a tuple of the relative path to the testcase
@@ -101,15 +108,6 @@ def getCCSpec(self, compiler):
         else:
             return ""
 
-    def getDsymutilSpec(self):
-        """
-        Helper function to return the key-value string to specify the dsymutil
-        used for the make system.
-        """
-        if configuration.dsymutil:
-            return "DSYMUTIL={}".format(configuration.dsymutil)
-        return ""
-
     def getSDKRootSpec(self):
         """
         Helper function to return the key-value string to specify the SDK root
@@ -143,7 +141,7 @@ def buildDefault(self,
                 "all",
                 self.getArchSpec(architecture),
                 self.getCCSpec(compiler),
-                self.getDsymutilSpec(),
+                self.getExtraMakeArgs(),
                 self.getSDKRootSpec(),
                 self.getModuleCacheSpec(),
                 self.getCmdLine(dictionary)
@@ -168,7 +166,7 @@ def buildDwarf(self,
                 "MAKE_DSYM=NO",
                 self.getArchSpec(architecture),
                 self.getCCSpec(compiler),
-                self.getDsymutilSpec(),
+                self.getExtraMakeArgs(),
                 self.getSDKRootSpec(),
                 self.getModuleCacheSpec(),
                 self.getCmdLine(dictionary)
@@ -192,7 +190,7 @@ def buildDwo(self,
                 "MAKE_DSYM=NO", "MAKE_DWO=YES",
                 self.getArchSpec(architecture),
                 self.getCCSpec(compiler),
-                self.getDsymutilSpec(),
+                self.getExtraMakeArgs(),
                 self.getSDKRootSpec(),
                 self.getModuleCacheSpec(),
                 self.getCmdLine(dictionary)
@@ -216,7 +214,7 @@ def buildGModules(self,
                 "MAKE_DSYM=NO", "MAKE_GMODULES=YES",
                 self.getArchSpec(architecture),
                 self.getCCSpec(compiler),
-                self.getDsymutilSpec(),
+                self.getExtraMakeArgs(),
                 self.getSDKRootSpec(),
                 self.getModuleCacheSpec(),
                 self.getCmdLine(dictionary)

diff  --git a/lldb/packages/Python/lldbsuite/test/builders/darwin.py b/lldb/packages/Python/lldbsuite/test/builders/darwin.py
index 826a3b491514..ce0aa0b13343 100644
--- a/lldb/packages/Python/lldbsuite/test/builders/darwin.py
+++ b/lldb/packages/Python/lldbsuite/test/builders/darwin.py
@@ -1,7 +1,24 @@
 from .builder import Builder
 
+from lldbsuite.test import configuration
+
 
 class BuilderDarwin(Builder):
+    def getExtraMakeArgs(self):
+        """
+        Helper function to return extra argumentsfor the make system. This
+        method is meant to be overridden by platform specific builders.
+        """
+        args = dict()
+
+        if configuration.dsymutil:
+            args['DSYMUTIL'] = configuration.dsymutil
+
+        # Return extra args as a formatted string.
+        return ' '.join(
+            {'{}="{}"'.format(key, value)
+             for key, value in args.items()})
+
     def buildDsym(self,
                   sender=None,
                   architecture=None,
@@ -16,7 +33,7 @@ def buildDsym(self,
                 "MAKE_DSYM=YES",
                 self.getArchSpec(architecture),
                 self.getCCSpec(compiler),
-                self.getDsymutilSpec(),
+                self.getExtraMakeArgs(),
                 self.getSDKRootSpec(),
                 self.getModuleCacheSpec(), "all",
                 self.getCmdLine(dictionary)


        


More information about the lldb-commits mailing list