[llvm] [lldb][bazel] Generate SafeAutoloadPaths.inc in the Bazel overlay (PR #209454)

David Young via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 05:09:46 PDT 2026


https://github.com/youngd007 created https://github.com/llvm/llvm-project/pull/209454

The auto-load-paths mechanism added in #187031 generates SafeAutoloadPaths.inc via a CMake configure_file() of SafeAutoloadPaths.inc.in (lldb/source/Core/CMakeLists.txt), gated by the LLDB_SAFE_AUTO_LOAD_PATHS cache variable which defaults to empty. Debugger.cpp #includes SafeAutoloadPaths.inc, but the Bazel overlay never modeled the configure_file(), so the header is missing from the Bazel build of lldb Core.

Reproduce the generation with expand_template (substituting @SAFE_PATH_ENTRIES@ with "" to match the empty default). Emit the header under include/ and expose it via includes = ["include"] so the bare #include resolves, matching how Config.h and Version.inc are handled in this overlay.

assisted with: claude
I ensured this is valid bazel that Meta can translate into valid BUCK and build lldb with internally via buck2.  This appears to match a few other template/library pairs.

>From 998ad40bb2f11a212d24c03f7a472ffc55edd53a Mon Sep 17 00:00:00 2001
From: David Young <davidayoung at meta.com>
Date: Tue, 14 Jul 2026 05:07:01 -0700
Subject: [PATCH] [lldb][bazel] Generate SafeAutoloadPaths.inc in the Bazel
 overlay

The auto-load-paths mechanism added in #187031 generates
SafeAutoloadPaths.inc via a CMake configure_file() of
SafeAutoloadPaths.inc.in (lldb/source/Core/CMakeLists.txt), gated by the
LLDB_SAFE_AUTO_LOAD_PATHS cache variable which defaults to empty.
Debugger.cpp #includes SafeAutoloadPaths.inc, but the Bazel overlay never
modeled the configure_file(), so the header is missing from the Bazel
build of lldb Core.

Reproduce the generation with expand_template (substituting
@SAFE_PATH_ENTRIES@ with "" to match the empty default). Emit the header
under include/ and expose it via includes = ["include"] so the bare
#include resolves, matching how Config.h and Version.inc are handled in
this overlay.
---
 .../bazel/llvm-project-overlay/lldb/BUILD.bazel  | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel b/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
index 16c65d04058cb..cb23e48d798ff 100644
--- a/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
@@ -697,6 +697,21 @@ cc_library(
     ],
 )
 
+# SafeAutoloadPaths.inc is generated by CMake configure_file (default empty
+# LLDB_SAFE_AUTO_LOAD_PATHS); reproduce it here since Debugger.cpp includes it.
+expand_template(
+    name = "safe_autoload_paths_inc_gen",
+    out = "include/SafeAutoloadPaths.inc",
+    substitutions = {"@SAFE_PATH_ENTRIES@": ""},
+    template = "source/Core/SafeAutoloadPaths.inc.in",
+)
+
+cc_library(
+    name = "SafeAutoloadPaths",
+    includes = ["include"],
+    textual_hdrs = [":safe_autoload_paths_inc_gen"],
+)
+
 cc_library(
     name = "Core",
     srcs = glob(
@@ -726,6 +741,7 @@ cc_library(
         ":Headers",
         ":Host",
         ":InterpreterHeaders",
+        ":SafeAutoloadPaths",
         ":SymbolHeaders",
         ":TargetHeaders",
         ":Utility",



More information about the llvm-commits mailing list