aboutsummaryrefslogtreecommitdiff
path: root/modules/llvm.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/llvm.py')
-rw-r--r--modules/llvm.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/llvm.py b/modules/llvm.py
index 2ce4994..8d549fd 100644
--- a/modules/llvm.py
+++ b/modules/llvm.py
@@ -165,6 +165,22 @@ class LLVMSourceConfig(object):
# Visit LLVM last, in case getting the enabled subprojects errors out.
action(self.llvmSourceTree.repodir)
+ def for_each_subproj(self, action):
+ """Perform the given action for each subproject excluding LLVM.
+
+ The action must be a callable object receiving an LLVMSubproject
+ parameter and a boolean representing whether the subproject is enabled
+ in the current configuration or not.
+
+ If the action throws an exception, it will be rethrown as a
+ RuntimeError. Note that this does not have transactional behaviour.
+ """
+ for subprojName, subproj in self.subprojs.items():
+ try:
+ action(subproj, self.__is_enabled(subprojName))
+ except Exception as exc:
+ raise RuntimeError("Error while processing {}".format(subprojName)) from exc
+
def __get_subproj_object(self, subprojName):
"""Get the LLVMSubproject object corresponding to subprojName."""
if not subprojName in list(self.subprojs.keys()):