llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-ssaf

Author: Balázs Benics (steakhal)

<details>
<summary>Changes</summary>

Problem:

ASTEntityMapping::getEntityName() creates EntityName with an empty 
NestedBuildNamespace, but the linker expected the TU namespace to already be 
present in the EntityName. This caused internal linkage symbols to conflict 
during linking: since their NestedBuildNamespace was empty, they all inherited 
the same LU namespace during resolution, making internal symbols from different 
TUs appear identical. For example, two "static inline" functions with the same 
USR in separate TUs would be incorrectly merged into a single LU entity instead 
of remaining distinct.

This is now fixed and demonstrated by the
InternalLinkageWithEmptyNamespaceAcrossTUs test, which creates two internal 
linkage symbols across two TUs and verifies they remain separate after linking.

---

TU summaries now omit the "namespace" field from entity names in JSON, since 
the linker adds TU namespace qualification at link time. LU (and WPA) summaries 
retain the "namespace" field as before, since their entity names are fully 
resolved.

Split entityNameFromJSON/entityNameToJSON into TU and LU variants:
- tuEntityNameFromJSON: reads only "usr" and "suffix"
- tuEntityNameToJSON: writes only "usr" and "suffix"
- luEntityNameFromJSON/luEntityNameToJSON: full behavior with required 
"namespace" field

Similarly split entityIdTableEntry and entityIdTable functions. Shared helpers 
(entityNameCoreFromJSON, entityIdTableFromJSONImpl) to avoid code duplication.

Update all TU JSON test inputs to remove the "namespace" field, and update unit 
tests accordingly.

---

Alternatively, we could choose to populate the NestedBuildNamespace with the TU 
namespace when creating an EntityName, thus meet the linker expectation. 
However, this would bloat the representation, and also make it redundant.

Assisted-By: claude

---

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


30 Files Affected:

- (modified) 
clang/include/clang/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.h
 (+2-1) 
- (modified) 
clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat.h
 (+17-6) 
- (modified) 
clang/lib/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.cpp 
(+11-4) 
- (modified) 
clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
 (+147-28) 
- (modified) 
clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/LUSummary.cpp
 (+2-2) 
- (modified) 
clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/LUSummaryEncoding.cpp
 (+2-2) 
- (modified) 
clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/TUSummary.cpp
 (+2-2) 
- (modified) 
clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/TUSummaryEncoding.cpp
 (+2-2) 
- (modified) 
clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/WPASuite.cpp
 (+2-2) 
- (modified) 
clang/test/Analysis/Scalable/UnsafeBufferUsage/Inputs/tu-summary-bad-element.json
 (-2) 
- (modified) 
clang/test/Analysis/Scalable/UnsafeBufferUsage/Inputs/tu-summary-bad-ptr-level.json
 (-2) 
- (modified) 
clang/test/Analysis/Scalable/UnsafeBufferUsage/Inputs/tu-summary-no-key.json 
(-2) 
- (modified) 
clang/test/Analysis/Scalable/UnsafeBufferUsage/Inputs/tu-summary.json (-3) 
- (modified) 
clang/test/Analysis/Scalable/ssaf-format/Inputs/CallGraph/invalid-direct-callee-element.json
 (-6) 
- (modified) 
clang/test/Analysis/Scalable/ssaf-format/Inputs/CallGraph/invalid-direct-callee-id.json
 (-6) 
- (modified) 
clang/test/Analysis/Scalable/ssaf-format/Inputs/CallGraph/missing-def-col.json 
(-6) 
- (modified) 
clang/test/Analysis/Scalable/ssaf-format/Inputs/CallGraph/missing-def-file.json 
(-6) 
- (modified) 
clang/test/Analysis/Scalable/ssaf-format/Inputs/CallGraph/missing-def-line.json 
(-6) 
- (modified) 
clang/test/Analysis/Scalable/ssaf-format/Inputs/CallGraph/missing-def.json (-6) 
- (modified) 
clang/test/Analysis/Scalable/ssaf-format/Inputs/CallGraph/missing-direct-callees.json
 (-6) 
- (modified) 
clang/test/Analysis/Scalable/ssaf-format/Inputs/CallGraph/missing-pretty-name.json
 (-6) 
- (modified) 
clang/test/Analysis/Scalable/ssaf-format/Inputs/CallGraph/missing-virtual-callees.json
 (-6) 
- (modified) clang/test/Analysis/Scalable/ssaf-linker/Inputs/tu-1.json (-36) 
- (modified) clang/test/Analysis/Scalable/ssaf-linker/Inputs/tu-2.json (-36) 
- (modified) 
clang/test/Analysis/Scalable/ssaf-linker/Inputs/tu-invalid-entity-id-multikey.json
 (-6) 
- (modified) 
clang/test/Analysis/Scalable/ssaf-linker/Inputs/tu-invalid-entity-id-ref.json 
(-6) 
- (modified) 
clang/test/Analysis/Scalable/ssaf-linker/Inputs/tu-invalid-entity-id-value.json 
(-6) 
- (modified) 
clang/unittests/ScalableStaticAnalysisFramework/EntityLinkerTest.cpp (+30-1) 
- (modified) 
clang/unittests/ScalableStaticAnalysisFramework/Serialization/JSONFormatTest/LUSummaryTest.cpp
 (+3-3) 
- (modified) 
clang/unittests/ScalableStaticAnalysisFramework/Serialization/JSONFormatTest/TUSummaryTest.cpp
 (+23-323) 


``````````diff
diff --git 
a/clang/include/clang/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.h
 
b/clang/include/clang/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.h
index be8b2f43b1708..0d08e8df868bc 100644
--- 
a/clang/include/clang/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.h
+++ 
b/clang/include/clang/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.h
@@ -60,7 +60,8 @@ class EntityLinker {
   /// \param Linkage The linkage determining namespace resolution strategy.
   /// \returns The resolved LU EntityId.
   EntityId resolveEntity(const EntityName &OldName,
-                         const EntityLinkage &Linkage);
+                         const EntityLinkage &Linkage,
+                         const NestedBuildNamespace &TUNamespace);
 
   /// Resolves each TU EntityId to its corresponding LU EntityId.
   ///
diff --git 
a/clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat.h
 
b/clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat.h
index 43ac353a31e75..b0126a1abac9f 100644
--- 
a/clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat.h
+++ 
b/clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat.h
@@ -109,19 +109,30 @@ class JSONFormat final : public SerializationFormat {
   Array nestedBuildNamespaceToJSON(const NestedBuildNamespace &NBN) const;
 
   llvm::Expected<EntityName>
-  entityNameFromJSON(const Object &EntityNameObject) const;
-  Object entityNameToJSON(const EntityName &EN) const;
+  tuEntityNameFromJSON(const Object &EntityNameObject) const;
+  Object tuEntityNameToJSON(const EntityName &EN) const;
+
+  llvm::Expected<EntityName>
+  luEntityNameFromJSON(const Object &EntityNameObject) const;
+  Object luEntityNameToJSON(const EntityName &EN) const;
 
   llvm::Expected<EntityLinkage>
   entityLinkageFromJSON(const Object &EntityLinkageObject) const;
   Object entityLinkageToJSON(const EntityLinkage &EL) const;
 
   llvm::Expected<std::pair<EntityName, EntityId>>
-  entityIdTableEntryFromJSON(const Object &EntityIdTableEntryObject) const;
+  tuEntityIdTableEntryFromJSON(const Object &EntityIdTableEntryObject) const;
+  llvm::Expected<EntityIdTable>
+  tuEntityIdTableFromJSON(const Array &EntityIdTableArray) const;
+  Object tuEntityIdTableEntryToJSON(const EntityName &EN, EntityId EI) const;
+  Array tuEntityIdTableToJSON(const EntityIdTable &IdTable) const;
+
+  llvm::Expected<std::pair<EntityName, EntityId>>
+  luEntityIdTableEntryFromJSON(const Object &EntityIdTableEntryObject) const;
   llvm::Expected<EntityIdTable>
-  entityIdTableFromJSON(const Array &EntityIdTableArray) const;
-  Object entityIdTableEntryToJSON(const EntityName &EN, EntityId EI) const;
-  Array entityIdTableToJSON(const EntityIdTable &IdTable) const;
+  luEntityIdTableFromJSON(const Array &EntityIdTableArray) const;
+  Object luEntityIdTableEntryToJSON(const EntityName &EN, EntityId EI) const;
+  Array luEntityIdTableToJSON(const EntityIdTable &IdTable) const;
 
   llvm::Expected<std::pair<EntityId, EntityLinkage>>
   linkageTableEntryFromJSON(const Object &LinkageTableEntryObject) const;
diff --git 
a/clang/lib/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.cpp 
b/clang/lib/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.cpp
index 8731b58e57f2d..ac09c5a57bad5 100644
--- 
a/clang/lib/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.cpp
+++ 
b/clang/lib/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.cpp
@@ -48,12 +48,16 @@ static constexpr const char *DuplicateTUNamespace =
 
 static NestedBuildNamespace
 resolveNamespace(const NestedBuildNamespace &LUNamespace,
+                 const NestedBuildNamespace &TUNamespace,
                  const NestedBuildNamespace &EntityNamespace,
                  EntityLinkageType Linkage) {
   switch (Linkage) {
   case EntityLinkageType::None:
   case EntityLinkageType::Internal:
-    return EntityNamespace.makeQualified(LUNamespace);
+    // Qualify with the TU namespace first (to disambiguate across TUs),
+    // then with the LU namespace.
+    return EntityNamespace.makeQualified(TUNamespace).makeQualified(
+        LUNamespace);
   case EntityLinkageType::External:
     return NestedBuildNamespace(LUNamespace);
   }
@@ -62,9 +66,11 @@ resolveNamespace(const NestedBuildNamespace &LUNamespace,
 }
 
 EntityId EntityLinker::resolveEntity(const EntityName &OldName,
-                                     const EntityLinkage &Linkage) {
+                                     const EntityLinkage &Linkage,
+                                     const NestedBuildNamespace &TUNamespace) {
   NestedBuildNamespace NewNamespace = resolveNamespace(
-      Output.LUNamespace, OldName.Namespace, Linkage.getLinkage());
+      Output.LUNamespace, TUNamespace, OldName.Namespace,
+      Linkage.getLinkage());
 
   EntityName NewName(OldName.USR, OldName.Suffix, NewNamespace);
 
@@ -103,7 +109,8 @@ EntityLinker::resolve(const TUSummaryEncoding &Summary) {
 
     const EntityLinkage &Linkage = Iter->second;
 
-    EntityId NewId = resolveEntity(OldName, Linkage);
+    EntityId NewId =
+        resolveEntity(OldName, Linkage, 
NestedBuildNamespace(Summary.TUNamespace));
 
     auto [_, Inserted] = EntityResolutionTable.insert({OldId, NewId});
     if (!Inserted) {
diff --git 
a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
 
b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
index f1dcd752f864f..49bda68962da2 100644
--- 
a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
+++ 
b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
@@ -311,8 +311,10 @@ Array JSONFormat::nestedBuildNamespaceToJSON(
 // EntityName
 //----------------------------------------------------------------------------
 
-llvm::Expected<EntityName>
-JSONFormat::entityNameFromJSON(const Object &EntityNameObject) const {
+/// Reads "usr" and "suffix" fields from an EntityName JSON object.
+/// Shared core logic for both TU and LU entity name deserialization.
+static llvm::Expected<std::pair<llvm::StringRef, llvm::StringRef>>
+entityNameCoreFromJSON(const Object &EntityNameObject) {
   const auto OptUSR = EntityNameObject.getString("usr");
   if (!OptUSR) {
     return ErrorBuilder::create(std::errc::invalid_argument,
@@ -329,6 +331,34 @@ JSONFormat::entityNameFromJSON(const Object 
&EntityNameObject) const {
         .build();
   }
 
+  return std::make_pair(*OptUSR, *OptSuffix);
+}
+
+llvm::Expected<EntityName>
+JSONFormat::tuEntityNameFromJSON(const Object &EntityNameObject) const {
+  auto ExpectedCore = entityNameCoreFromJSON(EntityNameObject);
+  if (!ExpectedCore)
+    return ExpectedCore.takeError();
+
+  auto [USR, Suffix] = *ExpectedCore;
+  return EntityName{USR, Suffix, NestedBuildNamespace()};
+}
+
+Object JSONFormat::tuEntityNameToJSON(const EntityName &EN) const {
+  Object Result;
+  Result["usr"] = getUSR(EN);
+  Result["suffix"] = getSuffix(EN);
+  return Result;
+}
+
+llvm::Expected<EntityName>
+JSONFormat::luEntityNameFromJSON(const Object &EntityNameObject) const {
+  auto ExpectedCore = entityNameCoreFromJSON(EntityNameObject);
+  if (!ExpectedCore)
+    return ExpectedCore.takeError();
+
+  auto [USR, Suffix] = *ExpectedCore;
+
   const Array *OptNamespaceArray = EntityNameObject.getArray("namespace");
   if (!OptNamespaceArray) {
     return ErrorBuilder::create(std::errc::invalid_argument,
@@ -345,10 +375,10 @@ JSONFormat::entityNameFromJSON(const Object 
&EntityNameObject) const {
         .build();
   }
 
-  return EntityName{*OptUSR, *OptSuffix, std::move(*ExpectedNamespace)};
+  return EntityName{USR, Suffix, std::move(*ExpectedNamespace)};
 }
 
-Object JSONFormat::entityNameToJSON(const EntityName &EN) const {
+Object JSONFormat::luEntityNameToJSON(const EntityName &EN) const {
   Object Result;
   Result["usr"] = getUSR(EN);
   Result["suffix"] = getSuffix(EN);
@@ -411,8 +441,34 @@ Object JSONFormat::entityLinkageToJSON(const EntityLinkage 
&EL) const {
 // EntityIdTableEntry
 //----------------------------------------------------------------------------
 
+/// Shared logic for reading the "id" field from an EntityIdTableEntry object.
+static llvm::Expected<EntityId>
+entityIdTableEntryIdFromJSON(const Object &EntityIdTableEntryObject,
+                             llvm::function_ref<EntityId(uint64_t)> MakeId) {
+  const Value *EntityIdIntValue = EntityIdTableEntryObject.get("id");
+  if (!EntityIdIntValue) {
+    return ErrorBuilder::create(std::errc::invalid_argument,
+                                ErrorMessages::FailedToReadObjectAtField,
+                                "EntityId", "id",
+                                "number (unsigned 64-bit integer)")
+        .build();
+  }
+
+  const std::optional<uint64_t> OptEntityIdInt =
+      EntityIdIntValue->getAsUINT64();
+  if (!OptEntityIdInt) {
+    return ErrorBuilder::create(std::errc::invalid_argument,
+                                ErrorMessages::FailedToReadObjectAtField,
+                                "EntityId", "id",
+                                "number (unsigned 64-bit integer)")
+        .build();
+  }
+
+  return MakeId(*OptEntityIdInt);
+}
+
 llvm::Expected<std::pair<EntityName, EntityId>>
-JSONFormat::entityIdTableEntryFromJSON(
+JSONFormat::tuEntityIdTableEntryFromJSON(
     const Object &EntityIdTableEntryObject) const {
 
   const Object *OptEntityNameObject =
@@ -424,42 +480,64 @@ JSONFormat::entityIdTableEntryFromJSON(
         .build();
   }
 
-  auto ExpectedEntityName = entityNameFromJSON(*OptEntityNameObject);
+  auto ExpectedEntityName = tuEntityNameFromJSON(*OptEntityNameObject);
   if (!ExpectedEntityName) {
     return ErrorBuilder::wrap(ExpectedEntityName.takeError())
         .context(ErrorMessages::ReadingFromField, "EntityName", "name")
         .build();
   }
 
-  const Value *EntityIdIntValue = EntityIdTableEntryObject.get("id");
-  if (!EntityIdIntValue) {
+  auto ExpectedId = entityIdTableEntryIdFromJSON(
+      EntityIdTableEntryObject,
+      [this](uint64_t V) { return entityIdFromJSON(V); });
+  if (!ExpectedId)
+    return ExpectedId.takeError();
+
+  return std::make_pair(std::move(*ExpectedEntityName), 
std::move(*ExpectedId));
+}
+
+Object JSONFormat::tuEntityIdTableEntryToJSON(const EntityName &EN,
+                                              EntityId EI) const {
+  Object Entry;
+  Entry["id"] = entityIdToJSON(EI);
+  Entry["name"] = tuEntityNameToJSON(EN);
+  return Entry;
+}
+
+llvm::Expected<std::pair<EntityName, EntityId>>
+JSONFormat::luEntityIdTableEntryFromJSON(
+    const Object &EntityIdTableEntryObject) const {
+
+  const Object *OptEntityNameObject =
+      EntityIdTableEntryObject.getObject("name");
+  if (!OptEntityNameObject) {
     return ErrorBuilder::create(std::errc::invalid_argument,
                                 ErrorMessages::FailedToReadObjectAtField,
-                                "EntityId", "id",
-                                "number (unsigned 64-bit integer)")
+                                "EntityName", "name", "object")
         .build();
   }
 
-  const std::optional<uint64_t> OptEntityIdInt =
-      EntityIdIntValue->getAsUINT64();
-  if (!OptEntityIdInt) {
-    return ErrorBuilder::create(std::errc::invalid_argument,
-                                ErrorMessages::FailedToReadObjectAtField,
-                                "EntityId", "id",
-                                "number (unsigned 64-bit integer)")
+  auto ExpectedEntityName = luEntityNameFromJSON(*OptEntityNameObject);
+  if (!ExpectedEntityName) {
+    return ErrorBuilder::wrap(ExpectedEntityName.takeError())
+        .context(ErrorMessages::ReadingFromField, "EntityName", "name")
         .build();
   }
 
-  EntityId EI = entityIdFromJSON(*OptEntityIdInt);
+  auto ExpectedId = entityIdTableEntryIdFromJSON(
+      EntityIdTableEntryObject,
+      [this](uint64_t V) { return entityIdFromJSON(V); });
+  if (!ExpectedId)
+    return ExpectedId.takeError();
 
-  return std::make_pair(std::move(*ExpectedEntityName), std::move(EI));
+  return std::make_pair(std::move(*ExpectedEntityName), 
std::move(*ExpectedId));
 }
 
-Object JSONFormat::entityIdTableEntryToJSON(const EntityName &EN,
-                                            EntityId EI) const {
+Object JSONFormat::luEntityIdTableEntryToJSON(const EntityName &EN,
+                                              EntityId EI) const {
   Object Entry;
   Entry["id"] = entityIdToJSON(EI);
-  Entry["name"] = entityNameToJSON(EN);
+  Entry["name"] = luEntityNameToJSON(EN);
   return Entry;
 }
 
@@ -467,10 +545,18 @@ Object JSONFormat::entityIdTableEntryToJSON(const 
EntityName &EN,
 // EntityIdTable
 //----------------------------------------------------------------------------
 
-llvm::Expected<EntityIdTable>
-JSONFormat::entityIdTableFromJSON(const Array &EntityIdTableArray) const {
+/// Shared logic for deserializing an EntityIdTable from a JSON array.
+/// \p EntryReader is called for each entry object to produce an
+/// (EntityName, EntityId) pair.
+static llvm::Expected<EntityIdTable> entityIdTableFromJSONImpl(
+    const Array &EntityIdTableArray,
+    llvm::function_ref<llvm::Expected<std::pair<EntityName, EntityId>>(
+        const Object &)>
+        EntryReader,
+    llvm::function_ref<std::map<EntityName, EntityId> &(EntityIdTable &)>
+        GetEntities) {
   EntityIdTable IdTable;
-  std::map<EntityName, EntityId> &Entities = getEntities(IdTable);
+  std::map<EntityName, EntityId> &Entities = GetEntities(IdTable);
 
   for (const auto &[Index, EntityIdTableEntryValue] :
        llvm::enumerate(EntityIdTableArray)) {
@@ -484,7 +570,7 @@ JSONFormat::entityIdTableFromJSON(const Array 
&EntityIdTableArray) const {
     }
 
     auto ExpectedEntityIdTableEntry =
-        entityIdTableEntryFromJSON(*OptEntityIdTableEntryObject);
+        EntryReader(*OptEntityIdTableEntryObject);
     if (!ExpectedEntityIdTableEntry) {
       return ErrorBuilder::wrap(ExpectedEntityIdTableEntry.takeError())
           .context(ErrorMessages::ReadingFromIndex, "EntityIdTable entry",
@@ -506,14 +592,47 @@ JSONFormat::entityIdTableFromJSON(const Array 
&EntityIdTableArray) const {
   return IdTable;
 }
 
-Array JSONFormat::entityIdTableToJSON(const EntityIdTable &IdTable) const {
+llvm::Expected<EntityIdTable>
+JSONFormat::tuEntityIdTableFromJSON(const Array &EntityIdTableArray) const {
+  return entityIdTableFromJSONImpl(
+      EntityIdTableArray,
+      [this](const Object &O) { return tuEntityIdTableEntryFromJSON(O); },
+      [](EntityIdTable &T) -> std::map<EntityName, EntityId> & {
+        return getEntities(T);
+      });
+}
+
+Array JSONFormat::tuEntityIdTableToJSON(const EntityIdTable &IdTable) const {
+  Array EntityIdTableArray;
+  const auto &Entities = getEntities(IdTable);
+  EntityIdTableArray.reserve(Entities.size());
+
+  for (const auto &[EntityName, EntityId] : Entities) {
+    EntityIdTableArray.push_back(
+        tuEntityIdTableEntryToJSON(EntityName, EntityId));
+  }
+
+  return EntityIdTableArray;
+}
+
+llvm::Expected<EntityIdTable>
+JSONFormat::luEntityIdTableFromJSON(const Array &EntityIdTableArray) const {
+  return entityIdTableFromJSONImpl(
+      EntityIdTableArray,
+      [this](const Object &O) { return luEntityIdTableEntryFromJSON(O); },
+      [](EntityIdTable &T) -> std::map<EntityName, EntityId> & {
+        return getEntities(T);
+      });
+}
+
+Array JSONFormat::luEntityIdTableToJSON(const EntityIdTable &IdTable) const {
   Array EntityIdTableArray;
   const auto &Entities = getEntities(IdTable);
   EntityIdTableArray.reserve(Entities.size());
 
   for (const auto &[EntityName, EntityId] : Entities) {
     EntityIdTableArray.push_back(
-        entityIdTableEntryToJSON(EntityName, EntityId));
+        luEntityIdTableEntryToJSON(EntityName, EntityId));
   }
 
   return EntityIdTableArray;
diff --git 
a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/LUSummary.cpp
 
b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/LUSummary.cpp
index 924a4a325aafb..1137499ba28c9 100644
--- 
a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/LUSummary.cpp
+++ 
b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/LUSummary.cpp
@@ -67,7 +67,7 @@ llvm::Expected<LUSummary> 
JSONFormat::readLUSummary(llvm::StringRef Path) {
           .build();
     }
 
-    auto ExpectedIdTable = entityIdTableFromJSON(*IdTableArray);
+    auto ExpectedIdTable = luEntityIdTableFromJSON(*IdTableArray);
     if (!ExpectedIdTable) {
       return ErrorBuilder::wrap(ExpectedIdTable.takeError())
           .context(ErrorMessages::ReadingFromField, "IdTable", "id_table")
@@ -140,7 +140,7 @@ llvm::Error JSONFormat::writeLUSummary(const LUSummary &S,
 
   RootObject["lu_namespace"] = nestedBuildNamespaceToJSON(getLUNamespace(S));
 
-  RootObject["id_table"] = entityIdTableToJSON(getIdTable(S));
+  RootObject["id_table"] = luEntityIdTableToJSON(getIdTable(S));
 
   RootObject["linkage_table"] = linkageTableToJSON(getLinkageTable(S));
 
diff --git 
a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/LUSummaryEncoding.cpp
 
b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/LUSummaryEncoding.cpp
index 6098acc37b7b5..e748b021d1666 100644
--- 
a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/LUSummaryEncoding.cpp
+++ 
b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/LUSummaryEncoding.cpp
@@ -68,7 +68,7 @@ JSONFormat::readLUSummaryEncoding(llvm::StringRef Path) {
           .build();
     }
 
-    auto ExpectedIdTable = entityIdTableFromJSON(*IdTableArray);
+    auto ExpectedIdTable = luEntityIdTableFromJSON(*IdTableArray);
     if (!ExpectedIdTable) {
       return ErrorBuilder::wrap(ExpectedIdTable.takeError())
           .context(ErrorMessages::ReadingFromField, "IdTable", "id_table")
@@ -143,7 +143,7 @@ JSONFormat::writeLUSummaryEncoding(const LUSummaryEncoding 
&SummaryEncoding,
   RootObject["lu_namespace"] =
       nestedBuildNamespaceToJSON(getLUNamespace(SummaryEncoding));
 
-  RootObject["id_table"] = entityIdTableToJSON(getIdTable(SummaryEncoding));
+  RootObject["id_table"] = luEntityIdTableToJSON(getIdTable(SummaryEncoding));
 
   RootObject["linkage_table"] =
       linkageTableToJSON(getLinkageTable(SummaryEncoding));
diff --git 
a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/TUSummary.cpp
 
b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/TUSummary.cpp
index f1a58276554d8..cc9460e956e7a 100644
--- 
a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/TUSummary.cpp
+++ 
b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/TUSummary.cpp
@@ -67,7 +67,7 @@ llvm::Expected<TUSummary> 
JSONFormat::readTUSummary(llvm::StringRef Path) {
           .build();
     }
 
-    auto ExpectedIdTable = entityIdTableFromJSON(*IdTableArray);
+    auto ExpectedIdTable = tuEntityIdTableFromJSON(*IdTableArray);
     if (!ExpectedIdTable) {
       return ErrorBuilder::wrap(ExpectedIdTable.takeError())
           .context(ErrorMessages::ReadingFromField, "IdTable", "id_table")
@@ -140,7 +140,7 @@ llvm::Error JSONFormat::writeTUSummary(const TUSummary &S,
 
   RootObject["tu_namespace"] = buildNamespaceToJSON(getTUNamespace(S));
 
-  RootObject["id_table"] = entityIdTableToJSON(getIdTable(S));
+  RootObject["id_table"] = tuEntityIdTableToJSON(getIdTable(S));
 
   RootObject["linkage_table"] = linkageTableToJSON(getLinkageTable(S));
 
diff --git 
a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/TUSummaryEncoding.cpp
 
b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/TUSummaryEncoding.cpp
index 5cbc816264d2c..b16d70b6b0416 100644
--- 
a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/TUSummaryEncoding.cpp
+++ 
b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/TUSummaryEncoding.cpp
@@ -68,7 +68,7 @@ JSONFormat::readTUSummaryEncoding(llvm::StringRef Path) {
           .build();
     }
 
-    auto ExpectedIdTable = entityIdTableFromJSON(*IdTableArray);
+    auto ExpectedIdTable = tuEntityIdTableFromJSON(*IdTableArray);
     if (!ExpectedIdTable) {
       ...
[truncated]

``````````

</details>


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

Reply via email to