[llvm] llvm: Export IndexedCodeGenDataLazyLoading (PR #169563)

Fabrice de Gans via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 12:08:09 PST 2025


https://github.com/Steelskin created https://github.com/llvm/llvm-project/pull/169563

This is needed so the llvm-cgdata tool properly builds with `LLVM_BUILD_LLVM_DYLIB` so LLVM can be built as a DLL on Windows.

This effort is tracked in #109483.

>From 17a2cefb0b54905bdd8f11587a5ccbff85f46240 Mon Sep 17 00:00:00 2001
From: Fabroce de Gans <fabrice at thebrowser.company>
Date: Tue, 25 Nov 2025 15:05:23 -0500
Subject: [PATCH] llvm: Export IndexedCodeGenDataLazyLoading

This is needed so the llvm-cgdata tool properly builds with
`LLVM_BUILD_LLVM_DYLIB` so LLVM can be built as a DLL on Windows.

This effort is tracked in #109483.
---
 llvm/include/llvm/CGData/CodeGenDataReader.h | 3 +++
 llvm/tools/llvm-cgdata/llvm-cgdata.cpp       | 4 ----
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/llvm/include/llvm/CGData/CodeGenDataReader.h b/llvm/include/llvm/CGData/CodeGenDataReader.h
index f915ce0afcd7f..a656147a48610 100644
--- a/llvm/include/llvm/CGData/CodeGenDataReader.h
+++ b/llvm/include/llvm/CGData/CodeGenDataReader.h
@@ -16,6 +16,7 @@
 #include "llvm/CGData/CodeGenData.h"
 #include "llvm/CGData/OutlinedHashTreeRecord.h"
 #include "llvm/CGData/StableFunctionMapRecord.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/LineIterator.h"
 #include "llvm/Support/VirtualFileSystem.h"
@@ -99,6 +100,8 @@ class CodeGenDataReader {
   Error success() { return error(cgdata_error::success); }
 };
 
+LLVM_ABI extern cl::opt<bool> IndexedCodeGenDataLazyLoading;
+
 class LLVM_ABI IndexedCodeGenDataReader : public CodeGenDataReader {
   /// The codegen data file contents.
   std::unique_ptr<MemoryBuffer> DataBuffer;
diff --git a/llvm/tools/llvm-cgdata/llvm-cgdata.cpp b/llvm/tools/llvm-cgdata/llvm-cgdata.cpp
index ea89c4d1dd25f..66a7410782922 100644
--- a/llvm/tools/llvm-cgdata/llvm-cgdata.cpp
+++ b/llvm/tools/llvm-cgdata/llvm-cgdata.cpp
@@ -83,10 +83,6 @@ static CGDataAction Action;
 static std::optional<CGDataFormat> OutputFormat;
 static std::vector<std::string> InputFilenames;
 
-namespace llvm {
-extern cl::opt<bool> IndexedCodeGenDataLazyLoading;
-} // end namespace llvm
-
 static void exitWithError(Twine Message, StringRef Whence = "",
                           StringRef Hint = "") {
   WithColor::error();



More information about the llvm-commits mailing list