https://github.com/aviralg updated 
https://github.com/llvm/llvm-project/pull/177719

>From 8936ac81e26f50a4f11a96fbfa517bafb014da3d Mon Sep 17 00:00:00 2001
From: Aviral Goel <[email protected]>
Date: Fri, 23 Jan 2026 17:03:23 -0800
Subject: [PATCH 1/3] [SSAF] Add SerializationFormat Interface

---
 .../Serialization/SerializationFormat.h       | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 
clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h

diff --git 
a/clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h 
b/clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h
new file mode 100644
index 0000000000000..aec84e9e0cd74
--- /dev/null
+++ b/clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h
@@ -0,0 +1,65 @@
+//===- SerializationFormat.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
+//
+//===----------------------------------------------------------------------===//
+//
+// Abstract SerializationFormat interface for reading and writing
+// TUSummary and LinkUnitResolution data.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef CLANG_ANALYSIS_SCALABLE_SERIALIZATION_SERIALIZATION_FORMAT_H
+#define CLANG_ANALYSIS_SCALABLE_SERIALIZATION_SERIALIZATION_FORMAT_H
+
+#include "clang/Analysis/Scalable/Model/BuildNamespace.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include <string>
+#include <vector>
+
+namespace clang {
+namespace ssaf {
+
+class TUSummary;
+class EntityIdTable;
+class EntityName;
+class EntityId;
+class TUSummaryData;
+
+/// Abstract base class for serialization formats.
+class SerializationFormat {
+protected:
+  // Helpers providing access to implementation details of basic data 
structures
+  // for efficient serialization/deserialization.
+  static EntityIdTable &getIdTableForDeserialization(TUSummary &S);
+  static NestedBuildNamespace &
+  getCommonNamespaceForDeserialization(TUSummary &S);
+  static const EntityIdTable &getIdTable(const TUSummary &S);
+  static const NestedBuildNamespace &getCommonNamespace(const TUSummary &S);
+
+  static BuildNamespaceKind getBuildNamespaceKind(const BuildNamespace &BN);
+  static const std::string &getBuildNamespaceName(const BuildNamespace &BN);
+  static const std::vector<BuildNamespace> &
+  getNestedBuildNamespaces(const NestedBuildNamespace &NBN);
+
+  static const std::string &getEntityNameUSR(const EntityName &EN);
+  static const llvm::SmallString<16> &getEntityNameSuffix(const EntityName 
&EN);
+  static const NestedBuildNamespace &
+  getEntityNameNamespace(const EntityName &EN);
+
+public:
+  virtual ~SerializationFormat() = default;
+
+  virtual TUSummary readTUSummary(const std::string &Path) = 0;
+
+  virtual void writeTUSummary(const TUSummary &Summary,
+                              llvm::StringRef OutputDir) = 0;
+};
+
+} // namespace ssaf
+} // namespace clang
+
+#endif // CLANG_ANALYSIS_SCALABLE_SERIALIZATION_SERIALIZATION_FORMAT_H

>From c75216a2dda5c63ef6ed3b1a7917c268806d7e0d Mon Sep 17 00:00:00 2001
From: Aviral Goel <[email protected]>
Date: Mon, 26 Jan 2026 11:33:18 -0800
Subject: [PATCH 2/3] Use nested namespace and use llvm::StringRef instead of
 std::string

---
 .../Scalable/Serialization/SerializationFormat.h    | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git 
a/clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h 
b/clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h
index aec84e9e0cd74..3a6b044ca97fd 100644
--- a/clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h
+++ b/clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h
@@ -17,11 +17,9 @@
 #include "clang/Analysis/Scalable/Model/BuildNamespace.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"
-#include <string>
 #include <vector>
 
-namespace clang {
-namespace ssaf {
+namespace clang::ssaf {
 
 class TUSummary;
 class EntityIdTable;
@@ -41,11 +39,11 @@ class SerializationFormat {
   static const NestedBuildNamespace &getCommonNamespace(const TUSummary &S);
 
   static BuildNamespaceKind getBuildNamespaceKind(const BuildNamespace &BN);
-  static const std::string &getBuildNamespaceName(const BuildNamespace &BN);
+  static llvm::StringRef getBuildNamespaceName(const BuildNamespace &BN);
   static const std::vector<BuildNamespace> &
   getNestedBuildNamespaces(const NestedBuildNamespace &NBN);
 
-  static const std::string &getEntityNameUSR(const EntityName &EN);
+  static llvm::StringRef getEntityNameUSR(const EntityName &EN);
   static const llvm::SmallString<16> &getEntityNameSuffix(const EntityName 
&EN);
   static const NestedBuildNamespace &
   getEntityNameNamespace(const EntityName &EN);
@@ -53,13 +51,12 @@ class SerializationFormat {
 public:
   virtual ~SerializationFormat() = default;
 
-  virtual TUSummary readTUSummary(const std::string &Path) = 0;
+  virtual TUSummary readTUSummary(llvm::StringRef Path) = 0;
 
   virtual void writeTUSummary(const TUSummary &Summary,
                               llvm::StringRef OutputDir) = 0;
 };
 
-} // namespace ssaf
-} // namespace clang
+} // namespace clang::ssaf
 
 #endif // CLANG_ANALYSIS_SCALABLE_SERIALIZATION_SERIALIZATION_FORMAT_H

>From 866988c8cc1c12dc3010a619ec85a80d6e24e82e Mon Sep 17 00:00:00 2001
From: Aviral Goel <[email protected]>
Date: Tue, 27 Jan 2026 09:42:50 -0800
Subject: [PATCH 3/3] Reorder forward class declarations to be in alphabetical
 order

---
 .../Analysis/Scalable/Serialization/SerializationFormat.h     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h 
b/clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h
index 3a6b044ca97fd..a78a780634754 100644
--- a/clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h
+++ b/clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h
@@ -21,10 +21,10 @@
 
 namespace clang::ssaf {
 
-class TUSummary;
+class EntityId;
 class EntityIdTable;
 class EntityName;
-class EntityId;
+class TUSummary;
 class TUSummaryData;
 
 /// Abstract base class for serialization formats.

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to