[clang] [clang][ssaf] Add SerializationFormatRegistry [1/2] (PR #179516)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 5 03:03:58 PST 2026
================
@@ -0,0 +1,70 @@
+//===- SerializationFormatRegistry.h ----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Registry for SerializationFormats, and some helper functions.
+// To register some custom serialization format, insert this code:
+//
+// static SerializationFormatRegistry::Add<MyFormat>
+// RegisterFormat("MyFormat", "My awesome serialization format");
+//
+// Then implement the formatter for the specific analysis and register the
+// format info for it:
+//
+// namespace {
+// struct MyAnalysisFormatInfo : FormatInfo {
+// MyAnalysisFormatInfo() : FormatInfo{
+// SummaryName("MyAnalysis"),
+// serializeMyAnalysis,
+// deserializeMyAnalysis,
+// } {}
+// };
+// } // namespace
+//
+// static llvm::Registry<FormatInfo>::Add<MyAnalysisFormatInfo>
+// RegisterFormatInfo(
+// "MyAnalysisFormatInfo",
+// "The MyFormat format info implementation for MyAnalysis"
+// );
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef CLANG_ANALYSIS_SCALABLE_SERIALIZATION_SERIALIZATION_FORMAT_REGISTRY_H
+#define CLANG_ANALYSIS_SCALABLE_SERIALIZATION_SERIALIZATION_FORMAT_REGISTRY_H
+
+#include "clang/Analysis/Scalable/Serialization/SerializationFormat.h"
+#include "clang/Support/Compiler.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Registry.h"
+
+namespace clang::ssaf {
+
+/// Check if a SerializationFormat was registered with a given name.
+bool isFormatRegistered(llvm::StringRef FormatName);
----------------
steakhal wrote:
This is in a header. The `isFormatRegistered` function is within the `clang::ssaf` namespace, so `llvm` symbols shouldn't be available without qualification.
https://github.com/llvm/llvm-project/pull/179516
More information about the cfe-commits
mailing list