https://github.com/brunodf-gf created
https://github.com/llvm/llvm-project/pull/223390
In a GCC build, this fixes some warnings of the following kind:
```
clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlow.cpp:15:1:
warning: ‘clang::ssaf::PointerFlowEntitySummary
clang::ssaf::buildPointerFlowEntitySummary(EdgeSet)’ has not been declared
within ‘clang::ssaf’
15 | ssaf::buildPointerFlowEntitySummary(EdgeSet Edges) {
| ^~~~
In file included from
clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlow.cpp:9:
clang/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlow.h:29:35: note:
only here as a ‘friend’
29 | friend PointerFlowEntitySummary buildPointerFlowEntitySummary(EdgeSet
Edges);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Fixed by centralizing the function declarations in the header, which also
removes the duplication across multiple files/tests.
>From a2d68e2c38288c83a53920dbca264caeb8244e08 Mon Sep 17 00:00:00 2001
From: Bruno De Fraine <[email protected]>
Date: Mon, 14 Sep 2026 14:40:27 +0200
Subject: [PATCH] [SSAF][PointerFlow] Properly declare functions in header
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In a GCC build, this fixes some warnings of the following kind:
```
clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlow.cpp:15:1:
warning: ‘clang::ssaf::PointerFlowEntitySummary
clang::ssaf::buildPointerFlowEntitySummary(EdgeSet)’ has not been declared
within ‘clang::ssaf’
15 | ssaf::buildPointerFlowEntitySummary(EdgeSet Edges) {
| ^~~~
In file included from
clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlow.cpp:9:
clang/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlow.h:29:35: note:
only here as a ‘friend’
29 | friend PointerFlowEntitySummary buildPointerFlowEntitySummary(EdgeSet
Edges);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Fixed by centralizing the function declarations in the header, which also
removes the duplication across multiple files/tests.
---
.../Analyses/PointerFlow/PointerFlow.h | 6 ++++++
.../Analyses/UnsafeBufferUsage/UnsafeBufferUsage.h | 7 +++++++
.../Analyses/PointerFlow/PointerFlowExtractor.cpp | 4 ----
.../Analyses/PointerFlow/PointerFlowFormat.cpp | 6 ------
.../Analyses/UnsafeBufferUsage/UnsafeBufferUsageFormat.cpp | 6 ------
.../Analyses/PointerFlow/PointerFlowWPATest.cpp | 2 --
.../UnsafeBufferUsage/UnsafeBufferUsageWPATest.cpp | 3 ---
.../UnsafeBufferReachableAnalysisTest.cpp | 6 ------
8 files changed, 13 insertions(+), 27 deletions(-)
diff --git
a/clang/include/clang/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlow.h
b/clang/include/clang/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlow.h
index abff90cc37662..720b1f74c21cd 100644
---
a/clang/include/clang/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlow.h
+++
b/clang/include/clang/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlow.h
@@ -47,6 +47,12 @@ class PointerFlowEntitySummary final : public EntitySummary {
static SummaryName summaryName() { return SummaryName{Name.str()}; }
};
+
+PointerFlowEntitySummary buildPointerFlowEntitySummary(EdgeSet Edges);
+
+llvm::iterator_range<EdgeSet::const_iterator>
+getEdges(const PointerFlowEntitySummary &);
+
} // namespace clang::ssaf
#endif // LLVM_CLANG_SCALABLESTATICANALYSIS_ANALYSES_POINTERFLOW_POINTERFLOW_H
diff --git
a/clang/include/clang/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsage.h
b/clang/include/clang/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsage.h
index c84104c10db7e..b35a132f7e72a 100644
---
a/clang/include/clang/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsage.h
+++
b/clang/include/clang/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsage.h
@@ -45,6 +45,13 @@ class UnsafeBufferUsageEntitySummary final : public
EntitySummary {
static SummaryName summaryName() { return SummaryName{Name.str()}; }
};
+
+UnsafeBufferUsageEntitySummary
+ buildUnsafeBufferUsageEntitySummary(EntityPointerLevelSet);
+
+llvm::iterator_range<EntityPointerLevelSet::const_iterator>
+getUnsafeBuffers(const UnsafeBufferUsageEntitySummary &);
+
} // namespace clang::ssaf
#endif //
LLVM_CLANG_SCALABLESTATICANALYSIS_ANALYSES_UNSAFEBUFFERUSAGE_UNSAFEBUFFERUSAGE_H
diff --git
a/clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowExtractor.cpp
b/clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowExtractor.cpp
index 719929bd7d43a..8d5ab0f8a85ef 100644
---
a/clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowExtractor.cpp
+++
b/clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowExtractor.cpp
@@ -26,10 +26,6 @@
#include "llvm/Support/Error.h"
#include <memory>
-namespace clang::ssaf {
-extern PointerFlowEntitySummary buildPointerFlowEntitySummary(EdgeSet Edges);
-} // namespace clang::ssaf
-
namespace {
using namespace clang;
using namespace ssaf;
diff --git
a/clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowFormat.cpp
b/clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowFormat.cpp
index ccad92be9b745..3ca54873263f3 100644
---
a/clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowFormat.cpp
+++
b/clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowFormat.cpp
@@ -21,12 +21,6 @@ using Object = llvm::json::Object;
using Array = llvm::json::Array;
using Value = llvm::json::Value;
-ssaf::PointerFlowEntitySummary
-ssaf::buildPointerFlowEntitySummary(EdgeSet Edges);
-
-llvm::iterator_range<EdgeSet::const_iterator>
-ssaf::getEdges(const PointerFlowEntitySummary &Sum);
-
namespace {
constexpr const char *const PointerFlowKey = "PointerFlow";
} // namespace
diff --git
a/clang/lib/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsageFormat.cpp
b/clang/lib/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsageFormat.cpp
index 5fafe0e92abfa..aed305125ac76 100644
---
a/clang/lib/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsageFormat.cpp
+++
b/clang/lib/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsageFormat.cpp
@@ -21,12 +21,6 @@ using Object = llvm::json::Object;
static constexpr llvm::StringLiteral SummarySerializationKey = "UnsafeBuffers";
-extern UnsafeBufferUsageEntitySummary
-ssaf::buildUnsafeBufferUsageEntitySummary(EntityPointerLevelSet UnsafeBuffers);
-
-extern llvm::iterator_range<EntityPointerLevelSet::const_iterator>
-ssaf::getUnsafeBuffers(const UnsafeBufferUsageEntitySummary &S);
-
static Object serialize(const EntitySummary &S,
JSONFormat::EntityIdToJSONFn Fn) {
const auto &SS = static_cast<const UnsafeBufferUsageEntitySummary &>(S);
diff --git
a/clang/unittests/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowWPATest.cpp
b/clang/unittests/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowWPATest.cpp
index 8c43ead9750ca..2684c4d7e6e49 100644
---
a/clang/unittests/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowWPATest.cpp
+++
b/clang/unittests/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowWPATest.cpp
@@ -27,8 +27,6 @@ using namespace ssaf;
using testing::IsEmpty;
using testing::UnorderedElementsAre;
-PointerFlowEntitySummary ssaf::buildPointerFlowEntitySummary(EdgeSet Edges);
-
namespace {
class PointerFlowWPATest : public TestFixture {
diff --git
a/clang/unittests/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsageWPATest.cpp
b/clang/unittests/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsageWPATest.cpp
index 448f838297e8f..6b388795056bf 100644
---
a/clang/unittests/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsageWPATest.cpp
+++
b/clang/unittests/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsageWPATest.cpp
@@ -27,9 +27,6 @@ using namespace ssaf;
using testing::IsEmpty;
using testing::UnorderedElementsAre;
-UnsafeBufferUsageEntitySummary
-ssaf::buildUnsafeBufferUsageEntitySummary(EntityPointerLevelSet UnsafeBuffers);
-
namespace {
class UnsafeBufferUsageWPATest : public TestFixture {
diff --git
a/clang/unittests/ScalableStaticAnalysis/WholeProgramAnalysis/UnsafeBufferReachableAnalysisTest.cpp
b/clang/unittests/ScalableStaticAnalysis/WholeProgramAnalysis/UnsafeBufferReachableAnalysisTest.cpp
index 7bfe39f98768f..d856bc14f436a 100644
---
a/clang/unittests/ScalableStaticAnalysis/WholeProgramAnalysis/UnsafeBufferReachableAnalysisTest.cpp
+++
b/clang/unittests/ScalableStaticAnalysis/WholeProgramAnalysis/UnsafeBufferReachableAnalysisTest.cpp
@@ -47,12 +47,6 @@
using namespace clang;
using namespace ssaf;
-namespace clang::ssaf {
-extern PointerFlowEntitySummary buildPointerFlowEntitySummary(EdgeSet Edges);
-extern UnsafeBufferUsageEntitySummary
- buildUnsafeBufferUsageEntitySummary(EntityPointerLevelSet);
-} // namespace clang::ssaf
-
namespace {
class UnsafeBufferReachableAnalysisTest : public TestFixture {
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits