[clang] 2034d85 - [clang][ssaf] Use `LLVM_DEFINE_REGISTRY` (adopt #185141) (#193457)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 1 04:35:09 PDT 2026


Author: Tomohiro Kashiwada
Date: 2026-05-01T12:35:05+01:00
New Revision: 2034d8530490ce198941d9feb660c329f1388fcf

URL: https://github.com/llvm/llvm-project/commit/2034d8530490ce198941d9feb660c329f1388fcf
DIFF: https://github.com/llvm/llvm-project/commit/2034d8530490ce198941d9feb660c329f1388fcf.diff

LOG: [clang][ssaf] Use `LLVM_DEFINE_REGISTRY` (adopt #185141) (#193457)

Added: 
    

Modified: 
    clang/docs/ScalableStaticAnalysisFramework/developer-docs/HowToExtend.rst
    clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat.h
    clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/SerializationFormatRegistry.h
    clang/include/clang/ScalableStaticAnalysisFramework/Core/SummaryData/SummaryDataBuilderRegistry.h
    clang/include/clang/ScalableStaticAnalysisFramework/Core/WholeProgramAnalysis/AnalysisRegistry.h
    clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
    clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/SerializationFormatRegistry.cpp
    clang/lib/ScalableStaticAnalysisFramework/Core/SummaryData/SummaryDataBuilderRegistry.cpp
    clang/lib/ScalableStaticAnalysisFramework/Core/WholeProgramAnalysis/AnalysisRegistry.cpp
    clang/unittests/ScalableStaticAnalysisFramework/Registries/MockSerializationFormat.cpp
    clang/unittests/ScalableStaticAnalysisFramework/Registries/MockSerializationFormat.h

Removed: 
    


################################################################################
diff  --git a/clang/docs/ScalableStaticAnalysisFramework/developer-docs/HowToExtend.rst b/clang/docs/ScalableStaticAnalysisFramework/developer-docs/HowToExtend.rst
index 7d92d7e6f2de7..e5c717bec0892 100644
--- a/clang/docs/ScalableStaticAnalysisFramework/developer-docs/HowToExtend.rst
+++ b/clang/docs/ScalableStaticAnalysisFramework/developer-docs/HowToExtend.rst
@@ -109,10 +109,7 @@ Your format class must inherit from ``SerializationFormat`` and define a ``Forma
 
   } // namespace clang::ssaf
 
-  namespace llvm {
-  extern template class CLANG_TEMPLATE_ABI
-      Registry<clang::ssaf::MyFormat::FormatInfo>;
-  } // namespace llvm
+  LLVM_DECLARE_REGISTRY(llvm::Registry<MyFormat::FormatInfo>)
 
 Step 2: Register the format
 ===========================
@@ -131,7 +128,7 @@ Step 2: Register the format
   static SerializationFormatRegistry::Add<MyFormat>
       RegisterFormat("myformat", "My awesome serialization format");
 
-  LLVM_INSTANTIATE_REGISTRY(llvm::Registry<MyFormat::FormatInfo>)
+  LLVM_DEFINE_REGISTRY(llvm::Registry<MyFormat::FormatInfo>)
 
 The format name (``"myformat"``) is matched against the file extension in ``--ssaf-tu-summary-file=output.myformat``.
 

diff  --git a/clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat.h b/clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat.h
index b0126a1abac9f..9f538c373e491 100644
--- a/clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat.h
+++ b/clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat.h
@@ -228,11 +228,8 @@ class JSONFormat final : public SerializationFormat {
 
 } // namespace clang::ssaf
 
-namespace llvm {
-extern template class CLANG_TEMPLATE_ABI
-    Registry<clang::ssaf::JSONFormat::FormatInfo>;
-extern template class CLANG_TEMPLATE_ABI
-    Registry<clang::ssaf::JSONFormat::AnalysisResultRegistry::Codec>;
-} // namespace llvm
+LLVM_DECLARE_REGISTRY(llvm::Registry<clang::ssaf::JSONFormat::FormatInfo>)
+LLVM_DECLARE_REGISTRY(
+    llvm::Registry<clang::ssaf::JSONFormat::AnalysisResultRegistry::Codec>)
 
 #endif // LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_CORE_SERIALIZATION_JSONFORMAT_H

diff  --git a/clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/SerializationFormatRegistry.h b/clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/SerializationFormatRegistry.h
index 5855cd84336e3..61b08b4c0a1bd 100644
--- a/clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/SerializationFormatRegistry.h
+++ b/clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/SerializationFormatRegistry.h
@@ -13,10 +13,7 @@
 //
 // Insert this code to the header file:
 //
-//   namespace llvm {
-//   extern template class CLANG_TEMPLATE_ABI
-//     Registry<clang::ssaf::MyFormat::FormatInfo>;
-//   } // namespace llvm
+//   LLVM_DECLARE_REGISTRY(llvm::Registry<MyFormat::FormatInfo>)
 //
 // Insert this declaration to the MyFormat class:
 //
@@ -28,7 +25,7 @@
 //   volatile int SSAFMyFormatAnchorSource = 0;
 //   static SerializationFormatRegistry::Add<MyFormat>
 //     RegisterFormat("MyFormat", "My awesome serialization format");
-//   LLVM_INSTANTIATE_REGISTRY(llvm::Registry<MyFormat::FormatInfo>)
+//   LLVM_DEFINE_REGISTRY(llvm::Registry<MyFormat::FormatInfo>)
 //
 // Then implement the formatter for the specific analysis and register the
 // format info for it:
@@ -89,9 +86,6 @@ using SerializationFormatRegistry = llvm::Registry<SerializationFormat>;
 
 } // namespace clang::ssaf
 
-namespace llvm {
-extern template class CLANG_TEMPLATE_ABI
-    Registry<clang::ssaf::SerializationFormat>;
-} // namespace llvm
+LLVM_DECLARE_REGISTRY(clang::ssaf::SerializationFormatRegistry)
 
 #endif // LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_CORE_SERIALIZATION_SERIALIZATIONFORMATREGISTRY_H

diff  --git a/clang/include/clang/ScalableStaticAnalysisFramework/Core/SummaryData/SummaryDataBuilderRegistry.h b/clang/include/clang/ScalableStaticAnalysisFramework/Core/SummaryData/SummaryDataBuilderRegistry.h
index 630e1c298f9e1..a153eff950534 100644
--- a/clang/include/clang/ScalableStaticAnalysisFramework/Core/SummaryData/SummaryDataBuilderRegistry.h
+++ b/clang/include/clang/ScalableStaticAnalysisFramework/Core/SummaryData/SummaryDataBuilderRegistry.h
@@ -27,6 +27,8 @@
 #include <memory>
 #include <string>
 
+LLVM_DECLARE_REGISTRY(llvm::Registry<clang::ssaf::SummaryDataBuilderBase>)
+
 namespace clang::ssaf {
 
 /// Registry for SummaryDataBuilder implementations.

diff  --git a/clang/include/clang/ScalableStaticAnalysisFramework/Core/WholeProgramAnalysis/AnalysisRegistry.h b/clang/include/clang/ScalableStaticAnalysisFramework/Core/WholeProgramAnalysis/AnalysisRegistry.h
index 44eabce6c809c..c1698db05abbb 100644
--- a/clang/include/clang/ScalableStaticAnalysisFramework/Core/WholeProgramAnalysis/AnalysisRegistry.h
+++ b/clang/include/clang/ScalableStaticAnalysisFramework/Core/WholeProgramAnalysis/AnalysisRegistry.h
@@ -41,6 +41,8 @@
 #include <string>
 #include <vector>
 
+LLVM_DECLARE_REGISTRY(llvm::Registry<clang::ssaf::AnalysisBase>)
+
 namespace clang::ssaf {
 
 /// Unified registry for SummaryAnalysis and DerivedAnalysis implementations.

diff  --git a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/JSONFormatImpl.cpp b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
index 8db7480e683f5..5d8d11dd47ea4 100644
--- a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
+++ b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
@@ -13,8 +13,8 @@
 
 // NOLINTNEXTLINE(misc-use-internal-linkage)
 volatile int SSAFJSONFormatAnchorSource = 0;
-LLVM_INSTANTIATE_REGISTRY(llvm::Registry<clang::ssaf::JSONFormat::FormatInfo>)
-LLVM_INSTANTIATE_REGISTRY(
+LLVM_DEFINE_REGISTRY(llvm::Registry<clang::ssaf::JSONFormat::FormatInfo>)
+LLVM_DEFINE_REGISTRY(
     llvm::Registry<clang::ssaf::JSONFormat::AnalysisResultRegistry::Codec>)
 
 static clang::ssaf::SerializationFormatRegistry::Add<clang::ssaf::JSONFormat>

diff  --git a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/SerializationFormatRegistry.cpp b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/SerializationFormatRegistry.cpp
index 0eb86f2fdee2f..1219635e5068d 100644
--- a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/SerializationFormatRegistry.cpp
+++ b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/SerializationFormatRegistry.cpp
@@ -12,7 +12,7 @@
 using namespace clang;
 using namespace ssaf;
 
-LLVM_INSTANTIATE_REGISTRY(SerializationFormatRegistry)
+LLVM_DEFINE_REGISTRY(SerializationFormatRegistry)
 
 bool ssaf::isFormatRegistered(llvm::StringRef FormatName) {
   for (const auto &Entry : SerializationFormatRegistry::entries())

diff  --git a/clang/lib/ScalableStaticAnalysisFramework/Core/SummaryData/SummaryDataBuilderRegistry.cpp b/clang/lib/ScalableStaticAnalysisFramework/Core/SummaryData/SummaryDataBuilderRegistry.cpp
index f0f2db91e6ba6..867290c6eac31 100644
--- a/clang/lib/ScalableStaticAnalysisFramework/Core/SummaryData/SummaryDataBuilderRegistry.cpp
+++ b/clang/lib/ScalableStaticAnalysisFramework/Core/SummaryData/SummaryDataBuilderRegistry.cpp
@@ -12,7 +12,7 @@ using namespace clang;
 using namespace ssaf;
 
 using RegistryT = llvm::Registry<SummaryDataBuilderBase>;
-LLVM_INSTANTIATE_REGISTRY(RegistryT)
+LLVM_DEFINE_REGISTRY(RegistryT)
 
 namespace {
 const RegistryT::entry *findEntry(llvm::StringRef Name) {

diff  --git a/clang/lib/ScalableStaticAnalysisFramework/Core/WholeProgramAnalysis/AnalysisRegistry.cpp b/clang/lib/ScalableStaticAnalysisFramework/Core/WholeProgramAnalysis/AnalysisRegistry.cpp
index 8e1ea954d9afd..01a95a85b705a 100644
--- a/clang/lib/ScalableStaticAnalysisFramework/Core/WholeProgramAnalysis/AnalysisRegistry.cpp
+++ b/clang/lib/ScalableStaticAnalysisFramework/Core/WholeProgramAnalysis/AnalysisRegistry.cpp
@@ -17,7 +17,7 @@ using RegistryT = llvm::Registry<AnalysisBase>;
 
 // NOLINTNEXTLINE(misc-use-internal-linkage)
 volatile int SSAFAnalysisRegistryAnchorSource = 0;
-LLVM_INSTANTIATE_REGISTRY(RegistryT)
+LLVM_DEFINE_REGISTRY(RegistryT)
 
 std::vector<AnalysisName> &AnalysisRegistry::getAnalysisNames() {
   static std::vector<AnalysisName> Names;

diff  --git a/clang/unittests/ScalableStaticAnalysisFramework/Registries/MockSerializationFormat.cpp b/clang/unittests/ScalableStaticAnalysisFramework/Registries/MockSerializationFormat.cpp
index 684249620e869..0ec7eb44c5755 100644
--- a/clang/unittests/ScalableStaticAnalysisFramework/Registries/MockSerializationFormat.cpp
+++ b/clang/unittests/ScalableStaticAnalysisFramework/Registries/MockSerializationFormat.cpp
@@ -30,7 +30,7 @@
 using namespace clang;
 using namespace ssaf;
 
-LLVM_INSTANTIATE_REGISTRY(llvm::Registry<MockSerializationFormat::FormatInfo>)
+LLVM_DEFINE_REGISTRY(llvm::Registry<MockSerializationFormat::FormatInfo>)
 
 MockSerializationFormat::MockSerializationFormat() {
   for (const auto &FormatInfoEntry : llvm::Registry<FormatInfo>::entries()) {

diff  --git a/clang/unittests/ScalableStaticAnalysisFramework/Registries/MockSerializationFormat.h b/clang/unittests/ScalableStaticAnalysisFramework/Registries/MockSerializationFormat.h
index 8e5d5e92063af..b780d7a25953a 100644
--- a/clang/unittests/ScalableStaticAnalysisFramework/Registries/MockSerializationFormat.h
+++ b/clang/unittests/ScalableStaticAnalysisFramework/Registries/MockSerializationFormat.h
@@ -69,9 +69,7 @@ class MockSerializationFormat final : public SerializationFormat {
 
 } // namespace clang::ssaf
 
-namespace llvm {
-extern template class CLANG_TEMPLATE_ABI
-    Registry<clang::ssaf::MockSerializationFormat::FormatInfo>;
-} // namespace llvm
+LLVM_DECLARE_REGISTRY(
+    llvm::Registry<clang::ssaf::MockSerializationFormat::FormatInfo>)
 
 #endif // LLVM_CLANG_UNITTESTS_SCALABLESTATICANALYSISFRAMEWORK_REGISTRIES_MOCKSERIALIZATIONFORMAT_H


        


More information about the cfe-commits mailing list