llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-ssaf

Author: Balázs Benics (steakhal)

<details>
<summary>Changes</summary>

This PR should be reviewed commit-by-commit.

My intention is to merge the first 3 commits as-is, and also get some feedback 
on the TUSummaryBuilder class and the unit test for it. That builder will 
change to enable better error handling but the APIs shouldn't change much to 
void the work already invested into the testing.

---

Patch is 36.97 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/180779.diff


21 Files Affected:

- (modified) clang/include/clang/Analysis/Scalable/Model/BuildNamespace.h 
(+3-4) 
- (modified) clang/include/clang/Analysis/Scalable/Model/EntityId.h (+6) 
- (added) clang/include/clang/Analysis/Scalable/Model/EntityLinkage.h (+27) 
- (modified) clang/include/clang/Analysis/Scalable/Model/EntityName.h (+1-1) 
- (added) clang/include/clang/Analysis/Scalable/Model/PrivateFieldNames.def 
(+31) 
- (modified) clang/include/clang/Analysis/Scalable/Model/SummaryName.h (+7) 
- (modified) 
clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h 
(+10-22) 
- (modified) clang/include/clang/Analysis/Scalable/TUSummary/TUSummary.h (+4) 
- (modified) clang/include/clang/Analysis/Scalable/TUSummary/TUSummaryBuilder.h 
(+22-1) 
- (modified) clang/lib/Analysis/Scalable/CMakeLists.txt (+3) 
- (added) clang/lib/Analysis/Scalable/Model/EntityId.cpp (+17) 
- (added) clang/lib/Analysis/Scalable/Model/SummaryName.cpp (+18) 
- (modified) clang/lib/Analysis/Scalable/Serialization/SerializationFormat.cpp 
(+3-61) 
- (added) clang/lib/Analysis/Scalable/TUSummary/TUSummaryBuilder.cpp (+26) 
- (modified) clang/unittests/Analysis/Scalable/CMakeLists.txt (+2) 
- (modified) 
clang/unittests/Analysis/Scalable/Registries/MockSerializationFormat.cpp (+1-1) 
- (modified) 
clang/unittests/Analysis/Scalable/Registries/MockTUSummaryBuilder.h (+1) 
- (modified) 
clang/unittests/Analysis/Scalable/Registries/SummaryExtractorRegistryTest.cpp 
(+13-3) 
- (added) clang/unittests/Analysis/Scalable/TUSummaryBuilderTest.cpp (+319) 
- (added) clang/unittests/Analysis/Scalable/TestFixture.cpp (+29) 
- (added) clang/unittests/Analysis/Scalable/TestFixture.h (+34) 


``````````diff
diff --git a/clang/include/clang/Analysis/Scalable/Model/BuildNamespace.h 
b/clang/include/clang/Analysis/Scalable/Model/BuildNamespace.h
index 5ca26df1e9252..2cd8990708b8d 100644
--- a/clang/include/clang/Analysis/Scalable/Model/BuildNamespace.h
+++ b/clang/include/clang/Analysis/Scalable/Model/BuildNamespace.h
@@ -63,6 +63,7 @@ class BuildNamespace {
   bool operator<(const BuildNamespace &Other) const;
 
   friend class SerializationFormat;
+  friend class TestFixture;
 };
 
 /// Represents a hierarchical sequence of build namespaces.
@@ -75,8 +76,6 @@ class BuildNamespace {
 /// For example, an entity might be qualified by a compilation unit namespace
 /// followed by a shared library namespace.
 class NestedBuildNamespace {
-  friend class SerializationFormat;
-
   std::vector<BuildNamespace> Namespaces;
 
 public:
@@ -114,8 +113,8 @@ class NestedBuildNamespace {
   bool operator!=(const NestedBuildNamespace &Other) const;
   bool operator<(const NestedBuildNamespace &Other) const;
 
-  friend class JSONWriter;
-  friend class LinkUnitResolution;
+  friend class SerializationFormat;
+  friend class TestFixture;
 };
 
 } // namespace clang::ssaf
diff --git a/clang/include/clang/Analysis/Scalable/Model/EntityId.h 
b/clang/include/clang/Analysis/Scalable/Model/EntityId.h
index 6fa059445d853..6e1b7ce276bda 100644
--- a/clang/include/clang/Analysis/Scalable/Model/EntityId.h
+++ b/clang/include/clang/Analysis/Scalable/Model/EntityId.h
@@ -17,6 +17,10 @@
 
 #include <cstddef>
 
+namespace llvm {
+class raw_ostream;
+} // namespace llvm
+
 namespace clang::ssaf {
 
 class EntityIdTable;
@@ -40,6 +44,8 @@ class EntityId {
   bool operator==(const EntityId &Other) const { return Index == Other.Index; }
   bool operator<(const EntityId &Other) const { return Index < Other.Index; }
   bool operator!=(const EntityId &Other) const { return !(*this == Other); }
+
+  friend llvm::raw_ostream &operator<<(llvm::raw_ostream &, const EntityId &);
 };
 
 } // namespace clang::ssaf
diff --git a/clang/include/clang/Analysis/Scalable/Model/EntityLinkage.h 
b/clang/include/clang/Analysis/Scalable/Model/EntityLinkage.h
new file mode 100644
index 0000000000000..a89ab200fbd79
--- /dev/null
+++ b/clang/include/clang/Analysis/Scalable/Model/EntityLinkage.h
@@ -0,0 +1,27 @@
+//===- EntityLinkage.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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_ANALYSIS_SCALABLE_MODEL_ENTITY_LINKAGE_H
+#define LLVM_CLANG_ANALYSIS_SCALABLE_MODEL_ENTITY_LINKAGE_H
+
+namespace clang::ssaf {
+
+class EntityLinkage {
+public:
+  // Empty for now.
+  bool operator==(const EntityLinkage &Other) const {
+    return true; // FIXME: Adjust this once no longer empty.
+  }
+  bool operator!=(const EntityLinkage &Other) const {
+    return !(*this == Other);
+  }
+};
+
+} // namespace clang::ssaf
+
+#endif // LLVM_CLANG_ANALYSIS_SCALABLE_MODEL_ENTITY_LINKAGE_H
diff --git a/clang/include/clang/Analysis/Scalable/Model/EntityName.h 
b/clang/include/clang/Analysis/Scalable/Model/EntityName.h
index 23890ab7bea43..72dd9ac803052 100644
--- a/clang/include/clang/Analysis/Scalable/Model/EntityName.h
+++ b/clang/include/clang/Analysis/Scalable/Model/EntityName.h
@@ -47,8 +47,8 @@ class EntityName {
   /// \param Namespace The namespace steps to append to this entity's 
namespace.
   EntityName makeQualified(NestedBuildNamespace Namespace) const;
 
-  friend class LinkUnitResolution;
   friend class SerializationFormat;
+  friend class TestFixture;
 };
 
 } // namespace clang::ssaf
diff --git a/clang/include/clang/Analysis/Scalable/Model/PrivateFieldNames.def 
b/clang/include/clang/Analysis/Scalable/Model/PrivateFieldNames.def
new file mode 100644
index 0000000000000..a91ff5952b807
--- /dev/null
+++ b/clang/include/clang/Analysis/Scalable/Model/PrivateFieldNames.def
@@ -0,0 +1,31 @@
+//===-- PrivateFieldNames.def -----------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file defines a list of non-static data members of the SSAF objects.
+//  These are used for granting access for:
+//   - SerializationFormat
+//   - TextFixture
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef FIELD
+#define FIELD(CLASS, FIELD_NAME)
+#endif
+
+FIELD(BuildNamespace, Kind)
+FIELD(BuildNamespace, Name)
+FIELD(EntityName, Namespace)
+FIELD(EntityName, Suffix)
+FIELD(EntityName, USR)
+FIELD(NestedBuildNamespace, Namespaces)
+FIELD(TUSummary, Data)
+FIELD(TUSummary, Entities)
+FIELD(TUSummary, IdTable)
+FIELD(TUSummary, TUNamespace)
+
+#undef FIELD
diff --git a/clang/include/clang/Analysis/Scalable/Model/SummaryName.h 
b/clang/include/clang/Analysis/Scalable/Model/SummaryName.h
index 785fe0eb10372..14929592b266b 100644
--- a/clang/include/clang/Analysis/Scalable/Model/SummaryName.h
+++ b/clang/include/clang/Analysis/Scalable/Model/SummaryName.h
@@ -12,6 +12,10 @@
 #include "llvm/ADT/StringRef.h"
 #include <string>
 
+namespace llvm {
+class raw_ostream;
+} // namespace llvm
+
 namespace clang::ssaf {
 
 /// Uniquely identifies an analysis summary.
@@ -29,6 +33,9 @@ class SummaryName {
   /// Explicit conversion to the underlying string representation.
   llvm::StringRef str() const { return Name; }
 
+  friend llvm::raw_ostream &operator<<(llvm::raw_ostream &,
+                                       const SummaryName &);
+
 private:
   std::string Name;
 };
diff --git 
a/clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h 
b/clang/include/clang/Analysis/Scalable/Serialization/SerializationFormat.h
index c7438e2859da0..2c0ca57f6db46 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 "clang/Analysis/Scalable/Model/SummaryName.h"
 #include "clang/Analysis/Scalable/TUSummary/TUSummary.h"
-#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ExtensibleRTTI.h"
 #include "llvm/Support/VirtualFileSystem.h"
-#include <vector>
 
 namespace clang::ssaf {
 
@@ -33,26 +31,6 @@ class EntitySummary;
 /// Abstract base class for serialization formats.
 class SerializationFormat
     : public llvm::RTTIExtends<SerializationFormat, llvm::RTTIRoot> {
-protected:
-  // Helpers providing access to implementation details of basic data 
structures
-  // for efficient serialization/deserialization.
-  static EntityIdTable &getIdTableForDeserialization(TUSummary &S);
-  static BuildNamespace &getTUNamespaceForDeserialization(TUSummary &S);
-  static const EntityIdTable &getIdTable(const TUSummary &S);
-  static const BuildNamespace &getTUNamespace(const TUSummary &S);
-
-  static BuildNamespaceKind getBuildNamespaceKind(const BuildNamespace &BN);
-  static llvm::StringRef getBuildNamespaceName(const BuildNamespace &BN);
-  static const std::vector<BuildNamespace> &
-  getNestedBuildNamespaces(const NestedBuildNamespace &NBN);
-
-  static llvm::StringRef getEntityNameUSR(const EntityName &EN);
-  static const llvm::SmallString<16> &getEntityNameSuffix(const EntityName 
&EN);
-  static const NestedBuildNamespace &
-  getEntityNameNamespace(const EntityName &EN);
-  static decltype(TUSummary::Data) &getData(TUSummary &S);
-  static const decltype(TUSummary::Data) &getData(const TUSummary &S);
-
 public:
   explicit SerializationFormat(
       llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS);
@@ -66,7 +44,17 @@ class SerializationFormat
   static char ID; // For RTTIExtends.
 
 protected:
+  // Helpers providing access to implementation details of basic data 
structures
+  // for efficient serialization/deserialization.
+#define FIELD(CLASS, FIELD_NAME)                                               
\
+  static const auto &get##FIELD_NAME(const CLASS &X) { return X.FIELD_NAME; }  
\
+  static auto &get##FIELD_NAME(CLASS &X) { return X.FIELD_NAME; }
+#include "clang/Analysis/Scalable/Model/PrivateFieldNames.def"
+
   llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS;
+
+private:
+  void anchor() override;
 };
 
 template <class SerializerFn, class DeserializerFn> struct FormatInfoEntry {
diff --git a/clang/include/clang/Analysis/Scalable/TUSummary/TUSummary.h 
b/clang/include/clang/Analysis/Scalable/TUSummary/TUSummary.h
index 4af1c70e1a488..9ed35a2c3828f 100644
--- a/clang/include/clang/Analysis/Scalable/TUSummary/TUSummary.h
+++ b/clang/include/clang/Analysis/Scalable/TUSummary/TUSummary.h
@@ -12,6 +12,7 @@
 #include "clang/Analysis/Scalable/Model/BuildNamespace.h"
 #include "clang/Analysis/Scalable/Model/EntityId.h"
 #include "clang/Analysis/Scalable/Model/EntityIdTable.h"
+#include "clang/Analysis/Scalable/Model/EntityLinkage.h"
 #include "clang/Analysis/Scalable/Model/SummaryName.h"
 #include "clang/Analysis/Scalable/TUSummary/EntitySummary.h"
 #include <map>
@@ -24,6 +25,7 @@ class TUSummary {
   /// Identifies the translation unit.
   BuildNamespace TUNamespace;
   EntityIdTable IdTable;
+  std::map<EntityId, EntityLinkage> Entities;
 
   std::map<SummaryName, std::map<EntityId, std::unique_ptr<EntitySummary>>>
       Data;
@@ -32,6 +34,8 @@ class TUSummary {
   TUSummary(BuildNamespace TUNamespace) : TUNamespace(std::move(TUNamespace)) 
{}
 
   friend class SerializationFormat;
+  friend class TestFixture;
+  friend class TUSummaryBuilder;
 };
 
 } // namespace clang::ssaf
diff --git a/clang/include/clang/Analysis/Scalable/TUSummary/TUSummaryBuilder.h 
b/clang/include/clang/Analysis/Scalable/TUSummary/TUSummaryBuilder.h
index fa679c145faa5..55dddb2d25656 100644
--- a/clang/include/clang/Analysis/Scalable/TUSummary/TUSummaryBuilder.h
+++ b/clang/include/clang/Analysis/Scalable/TUSummary/TUSummaryBuilder.h
@@ -9,10 +9,31 @@
 #ifndef LLVM_CLANG_ANALYSIS_SCALABLE_TUSUMMARY_TUSUMMARYBUILDER_H
 #define LLVM_CLANG_ANALYSIS_SCALABLE_TUSUMMARY_TUSUMMARYBUILDER_H
 
+#include <memory>
+
 namespace clang::ssaf {
 
+class EntityId;
+class EntityLinkage;
+class EntityName;
+class EntitySummary;
+class TUSummary;
+
 class TUSummaryBuilder {
-  // Empty for now.
+public:
+  explicit TUSummaryBuilder(TUSummary &Summary) : Summary(Summary) {}
+
+  /// Add an entity to the summary and return its EntityId.
+  /// If the entity already exists, returns the existing ID (idempotent).
+  EntityId addEntity(const EntityName &E, const EntityLinkage &Linkage);
+
+  /// Add analysis-specific fact data for an entity.
+  /// Precondition: The ContributingEntity must have been added via 
addEntity().
+  void addFact(EntityId ContributingEntity,
+               std::unique_ptr<EntitySummary> NewData);
+
+private:
+  TUSummary &Summary;
 };
 
 } // namespace clang::ssaf
diff --git a/clang/lib/Analysis/Scalable/CMakeLists.txt 
b/clang/lib/Analysis/Scalable/CMakeLists.txt
index 47fe87074d728..03bed630a78eb 100644
--- a/clang/lib/Analysis/Scalable/CMakeLists.txt
+++ b/clang/lib/Analysis/Scalable/CMakeLists.txt
@@ -5,12 +5,15 @@ set(LLVM_LINK_COMPONENTS
 add_clang_library(clangAnalysisScalable
   ASTEntityMapping.cpp
   Model/BuildNamespace.cpp
+  Model/EntityId.cpp
   Model/EntityIdTable.cpp
   Model/EntityName.cpp
+  Model/SummaryName.cpp
   Serialization/SerializationFormat.cpp
   Serialization/SerializationFormatRegistry.cpp
   TUSummary/EntitySummary.cpp
   TUSummary/ExtractorRegistry.cpp
+  TUSummary/TUSummaryBuilder.cpp
 
   LINK_LIBS
   clangAST
diff --git a/clang/lib/Analysis/Scalable/Model/EntityId.cpp 
b/clang/lib/Analysis/Scalable/Model/EntityId.cpp
new file mode 100644
index 0000000000000..2aa0ee312ca6b
--- /dev/null
+++ b/clang/lib/Analysis/Scalable/Model/EntityId.cpp
@@ -0,0 +1,17 @@
+//===- EntityId.cpp 
-------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Analysis/Scalable/Model/EntityId.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace clang;
+using namespace ssaf;
+
+llvm::raw_ostream &ssaf::operator<<(llvm::raw_ostream &OS, const EntityId &ID) 
{
+  return OS << "EntityId(" << ID.Index << ")";
+}
diff --git a/clang/lib/Analysis/Scalable/Model/SummaryName.cpp 
b/clang/lib/Analysis/Scalable/Model/SummaryName.cpp
new file mode 100644
index 0000000000000..663f8900dbec6
--- /dev/null
+++ b/clang/lib/Analysis/Scalable/Model/SummaryName.cpp
@@ -0,0 +1,18 @@
+//===- SummaryName.cpp 
----------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Analysis/Scalable/Model/SummaryName.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace clang;
+using namespace ssaf;
+
+llvm::raw_ostream &ssaf::operator<<(llvm::raw_ostream &OS,
+                                    const SummaryName &Name) {
+  return OS << "SummaryName(\"" << Name.str() << "\")";
+}
diff --git a/clang/lib/Analysis/Scalable/Serialization/SerializationFormat.cpp 
b/clang/lib/Analysis/Scalable/Serialization/SerializationFormat.cpp
index 1d62ea837616f..be2740d7a3e4c 100644
--- a/clang/lib/Analysis/Scalable/Serialization/SerializationFormat.cpp
+++ b/clang/lib/Analysis/Scalable/Serialization/SerializationFormat.cpp
@@ -7,70 +7,12 @@
 
//===----------------------------------------------------------------------===//
 
 #include "clang/Analysis/Scalable/Serialization/SerializationFormat.h"
-#include "clang/Analysis/Scalable/Model/BuildNamespace.h"
-#include "clang/Analysis/Scalable/Model/EntityId.h"
-#include "clang/Analysis/Scalable/Model/EntityName.h"
-#include "clang/Analysis/Scalable/TUSummary/TUSummary.h"
 
 using namespace clang::ssaf;
 
+char SerializationFormat::ID = 0;
+void SerializationFormat::anchor() {}
+
 SerializationFormat::SerializationFormat(
     llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS)
     : FS(FS) {}
-
-EntityIdTable &SerializationFormat::getIdTableForDeserialization(TUSummary &S) 
{
-  return S.IdTable;
-}
-
-BuildNamespace &
-SerializationFormat::getTUNamespaceForDeserialization(TUSummary &S) {
-  return S.TUNamespace;
-}
-
-const EntityIdTable &SerializationFormat::getIdTable(const TUSummary &S) {
-  return S.IdTable;
-}
-
-const BuildNamespace &SerializationFormat::getTUNamespace(const TUSummary &S) {
-  return S.TUNamespace;
-}
-
-BuildNamespaceKind
-SerializationFormat::getBuildNamespaceKind(const BuildNamespace &BN) {
-  return BN.Kind;
-}
-
-llvm::StringRef
-SerializationFormat::getBuildNamespaceName(const BuildNamespace &BN) {
-  return BN.Name;
-}
-
-const std::vector<BuildNamespace> &
-SerializationFormat::getNestedBuildNamespaces(const NestedBuildNamespace &NBN) 
{
-  return NBN.Namespaces;
-}
-
-llvm::StringRef SerializationFormat::getEntityNameUSR(const EntityName &EN) {
-  return EN.USR;
-}
-
-const llvm::SmallString<16> &
-SerializationFormat::getEntityNameSuffix(const EntityName &EN) {
-  return EN.Suffix;
-}
-
-const NestedBuildNamespace &
-SerializationFormat::getEntityNameNamespace(const EntityName &EN) {
-  return EN.Namespace;
-}
-
-const decltype(TUSummary::Data) &
-SerializationFormat::getData(const TUSummary &S) {
-  return S.Data;
-}
-
-decltype(TUSummary::Data) &SerializationFormat::getData(TUSummary &S) {
-  return S.Data;
-}
-
-char SerializationFormat::ID = 0;
diff --git a/clang/lib/Analysis/Scalable/TUSummary/TUSummaryBuilder.cpp 
b/clang/lib/Analysis/Scalable/TUSummary/TUSummaryBuilder.cpp
new file mode 100644
index 0000000000000..7dfae5e1bd0e2
--- /dev/null
+++ b/clang/lib/Analysis/Scalable/TUSummary/TUSummaryBuilder.cpp
@@ -0,0 +1,26 @@
+#include "clang/Analysis/Scalable/TUSummary/TUSummaryBuilder.h"
+#include "clang/Analysis/Scalable/Model/EntityId.h"
+#include "clang/Analysis/Scalable/Model/EntityLinkage.h"
+#include "clang/Analysis/Scalable/TUSummary/TUSummary.h"
+#include <memory>
+
+using namespace clang;
+using namespace ssaf;
+
+EntityId TUSummaryBuilder::addEntity(const EntityName &E,
+                                     const EntityLinkage &Linkage) {
+  EntityId Id = Summary.IdTable.getId(E);
+  const EntityLinkage &ExistingLinkage =
+      Summary.Entities.try_emplace(Id, Linkage).first->second;
+  if (ExistingLinkage != Linkage) {
+    // print ExistingLinkage, Linkage, and ID;
+    llvm::report_fatal_error("Entity already exists: ");
+  }
+  return Id;
+}
+
+void TUSummaryBuilder::addFact(EntityId ContributingEntity,
+                               std::unique_ptr<EntitySummary> NewData) {
+  Summary.Data[NewData->getSummaryName()][ContributingEntity] =
+      std::move(NewData);
+}
\ No newline at end of file
diff --git a/clang/unittests/Analysis/Scalable/CMakeLists.txt 
b/clang/unittests/Analysis/Scalable/CMakeLists.txt
index 601845b4ab77a..ca3f67a005707 100644
--- a/clang/unittests/Analysis/Scalable/CMakeLists.txt
+++ b/clang/unittests/Analysis/Scalable/CMakeLists.txt
@@ -11,6 +11,8 @@ add_distinct_clang_unittest(ClangScalableAnalysisTests
   Registries/SerializationFormatRegistryTest.cpp
   Registries/SummaryExtractorRegistryTest.cpp
   SummaryNameTest.cpp
+  TestFixture.cpp
+  TUSummaryBuilderTest.cpp
 
   CLANG_LIBS
   clangAnalysisScalable
diff --git 
a/clang/unittests/Analysis/Scalable/Registries/MockSerializationFormat.cpp 
b/clang/unittests/Analysis/Scalable/Registries/MockSerializationFormat.cpp
index 03328e8bd9742..127e61b26c0cb 100644
--- a/clang/unittests/Analysis/Scalable/Registries/MockSerializationFormat.cpp
+++ b/clang/unittests/Analysis/Scalable/Registries/MockSerializationFormat.cpp
@@ -67,7 +67,7 @@ TUSummary 
MockSerializationFormat::readTUSummary(llvm::StringRef Path) {
     assert(InfoEntry.ForSummary == Name);
 
     SpecialFileRepresentation Repr{(*InputFile)->getBuffer().str()};
-    auto &Table = getIdTableForDeserialization(Summary);
+    auto &Table = getIdTable(Summary);
 
     std::unique_ptr<EntitySummary> Result = InfoEntry.Deserialize(Repr, Table);
     if (!Result) // TODO: Handle error.
diff --git 
a/clang/unittests/Analysis/Scalable/Registries/MockTUSummaryBuilder.h 
b/clang/unittests/Analysis/Scalable/Registries/MockTUSummaryBuilder.h
index ccb79ae042625..755a47471a9f8 100644
--- a/clang/unittests/Analysis/Scalable/Registries/MockTUSummaryBuilder.h
+++ b/clang/unittests/Analysis/Scalable/Registries/MockTUSummaryBuilder.h
@@ -14,6 +14,7 @@ namespace clang::ssaf {
 
 class MockTUSummaryBuilder : public TUSummaryBuilder {
 public:
+  using TUSummaryBuilder::TUSummaryBuilder;
   void sendMessage(llvm::Twine Message) { Stream << Message << '\n'; }
   std::string consumeMessages() { return std::move(OutputBuffer); }
 
diff --git 
a/clang/unittests/Analysis/Scalable/Registries/SummaryExtractorRegistryTest.cpp 
b/clang/unittests/Analysis/Scalable/Registries/SummaryExtractorRegistryTest.cpp
index 2076fae0b5ab0..70c84363f389e 100644
--- 
a/clang/unittests/Analysis/Scalable/Registries/SummaryExtractorRegistryTest.cpp
+++ 
b/clang/unittests/Analysis/Scalable/Registries/SummaryExtractorRegistryTest.cpp
@@ -8,6 +8,7 @@
 
 #include "MockTUSummaryBuilder.h"
 #include "clang/Analysis/Scalable/TUSummary/ExtractorRegistry.h"
+#include "clang/Analysis/Scalable/TUSummary/TUSummary.h"
 #include "clang/Frontend/MultiplexConsumer.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/ADT/StringRef.h"
@@ -17,6 +18,12 @@
 using namespace clang;
 using namespace ssaf;
 
+static TUSummary makeFakeSummary() {
+  BuildNamespace NS(BuildNamespaceKind::CompilationUnit, "Mock.cpp");
+  TUSummary Summary(NS);
+  return Summary;
+}
+
 namespace {
 
 TEST(SummaryExtractorRegistryTest, isTUSummaryExtractorRegistered) {
@@ -39,7 +46,8 @@ TEST(SummaryExtractorRegist...
[truncated]

``````````

</details>


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

Reply via email to