[llvm] 154331 build with c++23 on main (PR #154372)

Kyle Krüger via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 09:08:31 PDT 2025


https://github.com/kykrueger created https://github.com/llvm/llvm-project/pull/154372

closes #154331 

This PR addresses all minimum changes needed to compile LLVM and MLIR with the c++23 standard.
It is a work in progress and to be reviewed for better methods of handling the parts of the build broken by c++23.

>From 9ac5abbf35c54eb5e3417eb5c55a8dc6941c2b10 Mon Sep 17 00:00:00 2001
From: Kyle Krueger <kyle-steven.krueger at charite.de>
Date: Tue, 19 Aug 2025 15:59:11 +0200
Subject: [PATCH 1/7] build with c++23

---
 llvm/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index b672cb9365284..133a76c0b6032 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -59,7 +59,7 @@ set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name
 include(GNUInstallDirs)
 
 # This C++ standard is required to build LLVM.
-set(LLVM_REQUIRED_CXX_STANDARD 17)
+set(LLVM_REQUIRED_CXX_STANDARD 23)
 
 # If we find that the cache contains CMAKE_CXX_STANDARD it means that it's a old CMakeCache.txt
 # and we can just inform the user and then reset it.

>From 53675f33188974a26576f871e9cf2d64f5fdeb23 Mon Sep 17 00:00:00 2001
From: Kyle Krueger <kyle-steven.krueger at charite.de>
Date: Tue, 19 Aug 2025 16:02:17 +0200
Subject: [PATCH 2/7] move RecordsEntry constructors out of header

[172/6259] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/Parser.cpp.o
FAILED: [code=1] lib/TableGen/CMakeFiles/LLVMTableGen.dir/Parser.cpp.o
/usr/bin/c++ -DEXPERIMENTAL_KEY_INSTRUCTIONS -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/kykrueger/repos/llvm-project/build/lib/TableGen -I/Users/kykrueger/repos
/llvm-project/llvm/lib/TableGen -I/Users/kykrueger/repos/llvm-project/build/include -I/Users/kykrueger/repos/llvm-project/llvm/include -isystem /opt/homebrew/include -fPIC -fvisibility-inlines-hidden -Werror=date-ti
me -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-
switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -O3 -DNDEBUG -std=c++2b -ar
ch arm64  -fno-exceptions -funwind-tables -fno-rtti -MD -MT lib/TableGen/CMakeFiles/LLVMTableGen.dir/Parser.cpp.o -MF lib/TableGen/CMakeFiles/LLVMTableGen.dir/Parser.cpp.o.d -o lib/TableGen/CMakeFiles/LLVMTableGen.d
ir/Parser.cpp.o -c /Users/kykrueger/repos/llvm-project/llvm/lib/TableGen/Parser.cpp
In file included from /Users/kykrueger/repos/llvm-project/llvm/lib/TableGen/Parser.cpp:10:
In file included from /Users/kykrueger/repos/llvm-project/llvm/lib/TableGen/TGParser.h:16:
In file included from /Users/kykrueger/repos/llvm-project/llvm/lib/TableGen/TGLexer.h:16:
In file included from /Users/kykrueger/repos/llvm-project/llvm/include/llvm/ADT/SmallVector.h:19:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:1846:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/inplace_merge.h:28:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:79:19: error: invalid application of 'sizeof' to an incomplete type 'llvm::ForeachLoop'
   79 |     static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
      |                   ^~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:293:7: note: in instantiation of member function 'std::default_delete<llvm::ForeachLoop>::operator()' requested here
  293 |       __ptr_.second()(__tmp);
      |       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:262:71: note: in instantiation of member function 'std::unique_ptr<llvm::ForeachLoop>::reset' requested here
  262 |   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
      |                                                                       ^
/Users/kykrueger/repos/llvm-project/llvm/lib/TableGen/TGParser.h:49:3: note: in instantiation of member function 'std::unique_ptr<llvm::ForeachLoop>::~unique_ptr' requested here
   49 |   RecordsEntry(std::unique_ptr<Record> Rec) : Rec(std::move(Rec)) {}
      |   ^
/Users/kykrueger/repos/llvm-project/llvm/lib/TableGen/TGParser.h:24:8: note: forward declaration of 'llvm::ForeachLoop'
   24 | struct ForeachLoop;
      |        ^
1 error generated.
---
 llvm/lib/TableGen/TGParser.cpp |  7 +++++++
 llvm/lib/TableGen/TGParser.h   | 10 ++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp
index 0c6add59cb282..5d23416b4610b 100644
--- a/llvm/lib/TableGen/TGParser.cpp
+++ b/llvm/lib/TableGen/TGParser.cpp
@@ -33,6 +33,13 @@ using namespace llvm;
 
 namespace llvm {
 
+RecordsEntry::RecordsEntry(std::unique_ptr<Record> Rec) : Rec(std::move(Rec)) {}
+RecordsEntry::RecordsEntry(std::unique_ptr<ForeachLoop> Loop) : Loop(std::move(Loop)) {}
+RecordsEntry::RecordsEntry(std::unique_ptr<Record::AssertionInfo> Assertion)
+      : Assertion(std::move(Assertion)) {}
+RecordsEntry::RecordsEntry(std::unique_ptr<Record::DumpInfo> Dump)
+      : Dump(std::move(Dump)) {}
+
 struct SubClassReference {
   SMRange RefRange;
   const Record *Rec = nullptr;
diff --git a/llvm/lib/TableGen/TGParser.h b/llvm/lib/TableGen/TGParser.h
index 7edb6c7a9aac6..09b7d5380695d 100644
--- a/llvm/lib/TableGen/TGParser.h
+++ b/llvm/lib/TableGen/TGParser.h
@@ -46,12 +46,10 @@ struct RecordsEntry {
   void dump() const;
 
   RecordsEntry() = default;
-  RecordsEntry(std::unique_ptr<Record> Rec) : Rec(std::move(Rec)) {}
-  RecordsEntry(std::unique_ptr<ForeachLoop> Loop) : Loop(std::move(Loop)) {}
-  RecordsEntry(std::unique_ptr<Record::AssertionInfo> Assertion)
-      : Assertion(std::move(Assertion)) {}
-  RecordsEntry(std::unique_ptr<Record::DumpInfo> Dump)
-      : Dump(std::move(Dump)) {}
+  RecordsEntry(std::unique_ptr<Record> Rec);
+  RecordsEntry(std::unique_ptr<ForeachLoop> Loop);
+  RecordsEntry(std::unique_ptr<Record::AssertionInfo> Assertion);
+  RecordsEntry(std::unique_ptr<Record::DumpInfo> Dump);
 };
 
 /// ForeachLoop - Record the iteration state associated with a for loop.

>From 32f6266a6ade2bbedc20399e71b6fca30a02028d Mon Sep 17 00:00:00 2001
From: Kyle Krueger <kyle-steven.krueger at charite.de>
Date: Tue, 19 Aug 2025 16:08:01 +0200
Subject: [PATCH 3/7] move BitstreamRemarkParser constructor out of header

---
 llvm/lib/Remarks/BitstreamRemarkParser.cpp | 2 ++
 llvm/lib/Remarks/BitstreamRemarkParser.h   | 3 +--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Remarks/BitstreamRemarkParser.cpp b/llvm/lib/Remarks/BitstreamRemarkParser.cpp
index 312886013598d..20a8ebbadc681 100644
--- a/llvm/lib/Remarks/BitstreamRemarkParser.cpp
+++ b/llvm/lib/Remarks/BitstreamRemarkParser.cpp
@@ -600,3 +600,5 @@ BitstreamRemarkParser::processRemark(BitstreamRemarkParserHelper &Helper) {
 
   return std::move(Result);
 }
+llvm::remarks::BitstreamRemarkParser::BitstreamRemarkParser(StringRef Buf)
+    : RemarkParser(Format::Bitstream), ParserHelper(Buf) {}
diff --git a/llvm/lib/Remarks/BitstreamRemarkParser.h b/llvm/lib/Remarks/BitstreamRemarkParser.h
index f6f79ef199f7e..061206471fee4 100644
--- a/llvm/lib/Remarks/BitstreamRemarkParser.h
+++ b/llvm/lib/Remarks/BitstreamRemarkParser.h
@@ -45,8 +45,7 @@ struct BitstreamRemarkParser : public RemarkParser {
 
   /// Create a parser that expects to find a string table embedded in the
   /// stream.
-  explicit BitstreamRemarkParser(StringRef Buf)
-      : RemarkParser(Format::Bitstream), ParserHelper(Buf) {}
+  explicit BitstreamRemarkParser(StringRef Buf);
 
   Expected<std::unique_ptr<Remark>> next() override;
 

>From 6f218f63eaa11f5563a51b5b25c8a014abc9064b Mon Sep 17 00:00:00 2001
From: Kyle Krueger <kyle-steven.krueger at charite.de>
Date: Tue, 19 Aug 2025 16:11:44 +0200
Subject: [PATCH 4/7] move MCGOFFStreamer constructor out of header

---
 llvm/include/llvm/MC/MCGOFFStreamer.h | 4 +---
 llvm/lib/MC/MCGOFFStreamer.cpp        | 7 +++++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/MC/MCGOFFStreamer.h b/llvm/include/llvm/MC/MCGOFFStreamer.h
index 6d029f6bd4a29..8888d9e7bdbb3 100644
--- a/llvm/include/llvm/MC/MCGOFFStreamer.h
+++ b/llvm/include/llvm/MC/MCGOFFStreamer.h
@@ -20,9 +20,7 @@ class MCGOFFStreamer : public MCObjectStreamer {
 public:
   MCGOFFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
                  std::unique_ptr<MCObjectWriter> OW,
-                 std::unique_ptr<MCCodeEmitter> Emitter)
-      : MCObjectStreamer(Context, std::move(MAB), std::move(OW),
-                         std::move(Emitter)) {}
+                 std::unique_ptr<MCCodeEmitter> Emitter);
 
   ~MCGOFFStreamer() override;
 
diff --git a/llvm/lib/MC/MCGOFFStreamer.cpp b/llvm/lib/MC/MCGOFFStreamer.cpp
index 1718e2a4eb2d7..f164c2d7365a8 100644
--- a/llvm/lib/MC/MCGOFFStreamer.cpp
+++ b/llvm/lib/MC/MCGOFFStreamer.cpp
@@ -45,3 +45,10 @@ MCStreamer *llvm::createGOFFStreamer(MCContext &Context,
       new MCGOFFStreamer(Context, std::move(MAB), std::move(OW), std::move(CE));
   return S;
 }
+llvm::MCGOFFStreamer::MCGOFFStreamer(MCContext &Context,
+                                     std::unique_ptr<MCAsmBackend> MAB,
+                                     std::unique_ptr<MCObjectWriter> OW,
+                                     std::unique_ptr<MCCodeEmitter> Emitter)
+    : MCObjectStreamer(Context, std::move(MAB), std::move(OW),
+                       std::move(Emitter)) {}
+

>From 6468b6e49068e6483d492a4fa769033d70ea3f0d Mon Sep 17 00:00:00 2001
From: Kyle Krueger <kyle-steven.krueger at charite.de>
Date: Tue, 19 Aug 2025 16:21:52 +0200
Subject: [PATCH 5/7] move default destructor of GsymContext out of header

[210/5529] Building CXX object lib/DebugInfo/GSYM/CMakeFiles/LLVMDebugInfoGSYM.dir/GsymContext.cpp.o
FAILED: [code=1] lib/DebugInfo/GSYM/CMakeFiles/LLVMDebugInfoGSYM.dir/GsymContext.cpp.o
/usr/bin/c++ -DEXPERIMENTAL_KEY_INSTRUCTIONS -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/kykrueger/repos/llvm-project/build/lib/DebugInfo/GSYM -I/Users/kykrueger
/repos/llvm-project/llvm/lib/DebugInfo/GSYM -I/Users/kykrueger/repos/llvm-project/build/include -I/Users/kykrueger/repos/llvm-project/llvm/include -isystem /opt/homebrew/include -fPIC -fvisibility-inlines-hidden -We
rror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthroug
h -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -O3 -DNDEBUG -s
td=c++2b -arch arm64  -fno-exceptions -funwind-tables -fno-rtti -MD -MT lib/DebugInfo/GSYM/CMakeFiles/LLVMDebugInfoGSYM.dir/GsymContext.cpp.o -MF lib/DebugInfo/GSYM/CMakeFiles/LLVMDebugInfoGSYM.dir/GsymContext.cpp.o
.d -o lib/DebugInfo/GSYM/CMakeFiles/LLVMDebugInfoGSYM.dir/GsymContext.cpp.o -c /Users/kykrueger/repos/llvm-project/llvm/lib/DebugInfo/GSYM/GsymContext.cpp
In file included from /Users/kykrueger/repos/llvm-project/llvm/lib/DebugInfo/GSYM/GsymContext.cpp:9:
In file included from /Users/kykrueger/repos/llvm-project/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h:12:
In file included from /Users/kykrueger/repos/llvm-project/llvm/include/llvm/DebugInfo/DIContext.h:17:
In file included from /Users/kykrueger/repos/llvm-project/llvm/include/llvm/ADT/SmallVector.h:19:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:1846:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/inplace_merge.h:28:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:79:19: error: invalid application of 'sizeof' to an incomplete type 'llvm::gsym::GsymReader'
   79 |     static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
      |                   ^~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:293:7: note: in instantiation of member function 'std::default_delete<llvm::gsym::GsymReader>::operator()' requested here
  293 |       __ptr_.second()(__tmp);
      |       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:262:71: note: in instantiation of member function 'std::unique_ptr<llvm::gsym::GsymReader>::reset' requested here
  262 |   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
      |                                                                       ^
/Users/kykrueger/repos/llvm-project/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h:30:7: note: in instantiation of member function 'std::unique_ptr<llvm::gsym::GsymReader>::~unique_ptr' requested here
   30 | class GsymContext : public DIContext {
      |       ^
/Users/kykrueger/repos/llvm-project/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h:30:7: note: in implicit destructor for 'llvm::gsym::GsymContext' first required here
/Users/kykrueger/repos/llvm-project/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h:21:7: note: forward declaration of 'llvm::gsym::GsymReader'
   21 | class GsymReader;
      |       ^
1 error generated.
---
 llvm/include/llvm/DebugInfo/GSYM/GsymContext.h | 1 +
 llvm/lib/DebugInfo/GSYM/GsymContext.cpp        | 1 +
 2 files changed, 2 insertions(+)

diff --git a/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h b/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h
index 9c04ff63c8059..07d599cf9b5c6 100644
--- a/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h
+++ b/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h
@@ -30,6 +30,7 @@ class GsymReader;
 class GsymContext : public DIContext {
 public:
   GsymContext(std::unique_ptr<GsymReader> Reader);
+  ~GsymContext();
 
   GsymContext(GsymContext &) = delete;
   GsymContext &operator=(GsymContext &) = delete;
diff --git a/llvm/lib/DebugInfo/GSYM/GsymContext.cpp b/llvm/lib/DebugInfo/GSYM/GsymContext.cpp
index 18be6d0985462..62b4caa327d87 100644
--- a/llvm/lib/DebugInfo/GSYM/GsymContext.cpp
+++ b/llvm/lib/DebugInfo/GSYM/GsymContext.cpp
@@ -14,6 +14,7 @@
 using namespace llvm;
 using namespace llvm::gsym;
 
+GsymContext::~GsymContext() = default;
 GsymContext::GsymContext(std::unique_ptr<GsymReader> Reader)
     : DIContext(CK_GSYM), Reader(std::move(Reader)) {}
 

>From d2c58961e755736666cfd96018d2e7fc66b07509 Mon Sep 17 00:00:00 2001
From: Kyle Krueger <kyle-steven.krueger at charite.de>
Date: Tue, 19 Aug 2025 17:15:27 +0200
Subject: [PATCH 6/7] complete forward-declared DebugInfo types for c++23
 constexpr

---
 llvm/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h        | 1 +
 llvm/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h        | 2 +-
 llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h | 2 ++
 llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h    | 2 ++
 llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp        | 9 +++++++++
 5 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/llvm/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h b/llvm/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h
index 7e15433b839ed..98f219ae76f31 100644
--- a/llvm/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h
+++ b/llvm/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h
@@ -10,6 +10,7 @@
 #define LLVM_DEBUGINFO_PDB_IPDBRAWSYMBOL_H
 
 #include "PDBTypes.h"
+#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
 #include "llvm/ADT/BitmaskEnum.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/DebugInfo/CodeView/CodeView.h"
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h
index d797d00cfa123..a7e8e60af7160 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h
@@ -10,6 +10,7 @@
 #define LLVM_DEBUGINFO_PDB_PDBSYMBOLFUNC_H
 
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
 #include "llvm/Support/Compiler.h"
 
 #include "PDBSymbol.h"
@@ -21,7 +22,6 @@ namespace pdb {
 
 class PDBSymDumper;
 class PDBSymbolData;
-class PDBSymbolTypeFunctionSig;
 template <typename ChildType> class IPDBEnumChildren;
 
 class LLVM_ABI PDBSymbolFunc : public PDBSymbol {
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h
index a054b0c02db83..d3bfa00ac9cde 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h
@@ -20,6 +20,8 @@ namespace pdb {
 class LLVM_ABI PDBSymbolTypeBuiltin : public PDBSymbol {
   DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::BuiltinType)
 public:
+
+  ~PDBSymbolTypeBuiltin();
   void dump(PDBSymDumper &Dumper) const override;
 
   FORWARD_SYMBOL_METHOD(getBuiltinType)
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h
index 431bf0dab90d9..acc58e10e71c7 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h
@@ -11,9 +11,11 @@
 
 #include "PDBSymbol.h"
 #include "PDBTypes.h"
+#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
 #include "llvm/Support/Compiler.h"
 
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
 
 namespace llvm {
 
diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp
index eca2a09c1f77b..1c121187c42a8 100644
--- a/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp
@@ -10,9 +10,18 @@
 
 #include "llvm/DebugInfo/PDB/PDBSymDumper.h"
 
+namespace llvm {
+namespace pdb {
+
+PDBSymbolTypeBuiltin::~PDBSymbolTypeBuiltin() = default;
+
+} // namespace pdb
+} // namespace llvm
+
 using namespace llvm;
 using namespace llvm::pdb;
 
+
 void PDBSymbolTypeBuiltin::dump(PDBSymDumper &Dumper) const {
   Dumper.dump(*this);
 }

>From f6e7150756603ea7b588e3ce678e7ba091aae2d6 Mon Sep 17 00:00:00 2001
From: Kyle Krueger <kyle-steven.krueger at charite.de>
Date: Tue, 19 Aug 2025 17:19:31 +0200
Subject: [PATCH 7/7] move InputFile constructors out of header

---
 llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h | 6 +++---
 llvm/lib/DebugInfo/PDB/Native/InputFile.cpp        | 5 +++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h b/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h
index 0e7b9663f27d2..71df1d59c2177 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h
@@ -55,9 +55,9 @@ class InputFile {
   getOrCreateTypeCollection(TypeCollectionKind Kind);
 
 public:
-  InputFile(PDBFile *Pdb) { PdbOrObj = Pdb; }
-  InputFile(object::COFFObjectFile *Obj) { PdbOrObj = Obj; }
-  InputFile(MemoryBuffer *Buffer) { PdbOrObj = Buffer; }
+  InputFile(PDBFile *Pdb);
+  InputFile(object::COFFObjectFile *Obj);
+  InputFile(MemoryBuffer *Buffer);
   LLVM_ABI ~InputFile();
   InputFile(InputFile &&Other) = default;
 
diff --git a/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp b/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
index 328d0f5ab060f..49be0edc33a10 100644
--- a/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
@@ -586,3 +586,8 @@ bool llvm::pdb::shouldDumpSymbolGroup(uint32_t Idx, const SymbolGroup &Group,
   // Otherwise, only dump if this is the same module specified.
   return (Filters.DumpModi == Idx);
 }
+llvm::pdb::InputFile::InputFile(PDBFile *Pdb) { PdbOrObj = Pdb; }
+
+llvm::pdb::InputFile::InputFile(object::COFFObjectFile *Obj) { PdbOrObj = Obj; }
+
+llvm::pdb::InputFile::InputFile(MemoryBuffer *Buffer) { PdbOrObj = Buffer; }



More information about the llvm-commits mailing list