[Lldb-commits] [lldb] [lldb][test] Assume clang supports -gmodules (PR #201333)

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 3 04:56:03 PDT 2026


https://github.com/Teemperor created https://github.com/llvm/llvm-project/pull/201333

We currently spend 50ms in most dotest invocations to check if clang supports `-gmodules`. The expensive part of this check is creating the clang process to run `clang --help`.

`-gmodules` was added 11 years ago and is present in any compiler that has even a remote chance in supporting the rest of our test suite. This patch just assumes that our compiler supports -gmodules if it is clang.

>From c372321fcc2e7a338e8ba7ccb60021a8ad050e91 Mon Sep 17 00:00:00 2001
From: Raphael Isemann <rise at apple.com>
Date: Wed, 3 Jun 2026 12:53:21 +0100
Subject: [PATCH] [lldb][test] Assume clang supports -gmodules

We currently spend 50ms in most dotest invocations to check if clang
supports `-gmodules`. The expensive part of this check is creating
the clang process to run `clang --help`.

`-gmodules` was added 11 years ago and is present in any compiler that
has even a remote chance in supporting the rest of our test suite. This
patch just assumes that our compiler supports -gmodules if it is clang.
---
 lldb/packages/Python/lldbsuite/support/gmodules.py | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/support/gmodules.py b/lldb/packages/Python/lldbsuite/support/gmodules.py
index 81185a5642266..00a01aebb909e 100644
--- a/lldb/packages/Python/lldbsuite/support/gmodules.py
+++ b/lldb/packages/Python/lldbsuite/support/gmodules.py
@@ -14,12 +14,7 @@ def is_compiler_clang_with_gmodules(compiler_path):
 
     def _gmodules_supported_internal():
         compiler = os.path.basename(compiler_path)
-        if "clang" not in compiler:
-            return False
-        else:
-            # Check the compiler help for the -gmodules option.
-            clang_help = os.popen("%s --help" % compiler_path).read()
-            return GMODULES_HELP_REGEX.search(clang_help, re.DOTALL) is not None
+        return "clang" in compiler
 
     GMODULES_SUPPORT_MAP[compiler_path] = _gmodules_supported_internal()
     return GMODULES_SUPPORT_MAP[compiler_path]



More information about the lldb-commits mailing list