[clang] [clang][ssaf] Rework NestedBuildNamespaces of TU and LU summaries (PR #191489)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 10 11:54:24 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- clang/include/clang/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.h clang/include/clang/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat.h clang/lib/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.cpp clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/JSONFormatImpl.cpp clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/LUSummary.cpp clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/LUSummaryEncoding.cpp clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/TUSummary.cpp clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/TUSummaryEncoding.cpp clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/WPASuite.cpp clang/unittests/ScalableStaticAnalysisFramework/EntityLinkerTest.cpp clang/unittests/ScalableStaticAnalysisFramework/Serialization/JSONFormatTest/LUSummaryTest.cpp clang/unittests/ScalableStaticAnalysisFramework/Serialization/JSONFormatTest/TUSummaryTest.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.cpp b/clang/lib/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.cpp
index ac09c5a57..5aff18999 100644
--- a/clang/lib/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.cpp
+++ b/clang/lib/ScalableStaticAnalysisFramework/Core/EntityLinker/EntityLinker.cpp
@@ -56,8 +56,8 @@ resolveNamespace(const NestedBuildNamespace &LUNamespace,
   case EntityLinkageType::Internal:
     // Qualify with the TU namespace first (to disambiguate across TUs),
     // then with the LU namespace.
-    return EntityNamespace.makeQualified(TUNamespace).makeQualified(
-        LUNamespace);
+    return EntityNamespace.makeQualified(TUNamespace)
+        .makeQualified(LUNamespace);
   case EntityLinkageType::External:
     return NestedBuildNamespace(LUNamespace);
   }
@@ -69,8 +69,7 @@ EntityId EntityLinker::resolveEntity(const EntityName &OldName,
                                      const EntityLinkage &Linkage,
                                      const NestedBuildNamespace &TUNamespace) {
   NestedBuildNamespace NewNamespace = resolveNamespace(
-      Output.LUNamespace, TUNamespace, OldName.Namespace,
-      Linkage.getLinkage());
+      Output.LUNamespace, TUNamespace, OldName.Namespace, Linkage.getLinkage());
 
   EntityName NewName(OldName.USR, OldName.Suffix, NewNamespace);
 
@@ -109,8 +108,8 @@ EntityLinker::resolve(const TUSummaryEncoding &Summary) {
 
     const EntityLinkage &Linkage = Iter->second;
 
-    EntityId NewId =
-        resolveEntity(OldName, Linkage, NestedBuildNamespace(Summary.TUNamespace));
+    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 49bda6896..8db7480e6 100644
--- a/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
+++ b/clang/lib/ScalableStaticAnalysisFramework/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
@@ -550,8 +550,8 @@ Object JSONFormat::luEntityIdTableEntryToJSON(const EntityName &EN,
 /// (EntityName, EntityId) pair.
 static llvm::Expected<EntityIdTable> entityIdTableFromJSONImpl(
     const Array &EntityIdTableArray,
-    llvm::function_ref<llvm::Expected<std::pair<EntityName, EntityId>>(
-        const Object &)>
+    llvm::function_ref<
+        llvm::Expected<std::pair<EntityName, EntityId>>(const Object &)>
         EntryReader,
     llvm::function_ref<std::map<EntityName, EntityId> &(EntityIdTable &)>
         GetEntities) {
@@ -569,8 +569,7 @@ static llvm::Expected<EntityIdTable> entityIdTableFromJSONImpl(
           .build();
     }
 
-    auto ExpectedEntityIdTableEntry =
-        EntryReader(*OptEntityIdTableEntryObject);
+    auto ExpectedEntityIdTableEntry = EntryReader(*OptEntityIdTableEntryObject);
     if (!ExpectedEntityIdTableEntry) {
       return ErrorBuilder::wrap(ExpectedEntityIdTableEntry.takeError())
           .context(ErrorMessages::ReadingFromIndex, "EntityIdTable entry",

``````````

</details>


https://github.com/llvm/llvm-project/pull/191489


More information about the cfe-commits mailing list