[clang] [SSAF][UnsafeBufferUsage] Add APIs to the EntityPointerLevel module for UnsafeBufferUsage (PR #191333)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 17 06:44:15 PDT 2026


================
@@ -10,33 +10,32 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/StmtVisitor.h"
+#include "clang/ScalableStaticAnalysisFramework/Analyses/EntityPointerLevel/EntityPointerLevelFormat.h"
 #include "clang/ScalableStaticAnalysisFramework/Core/ASTEntityMapping.h"
 #include "clang/ScalableStaticAnalysisFramework/Core/Model/EntityName.h"
+#include <optional>
 
 using namespace clang;
 using namespace ssaf;
 
-static bool hasPointerType(const Expr *E) {
-  auto Ty = E->getType();
-  return !Ty.isNull() && !Ty->isFunctionPointerType() &&
-         (Ty->isPointerType() || Ty->isArrayType());
+namespace {
+template <typename DeclOrExpr> bool hasPtrOrArrType(const DeclOrExpr *E) {
----------------
steakhal wrote:

Here it's a different story because we are in a CPP file, so it totally makes sense to have internal linkage for helper functions - including this template.
So here I'm fine with both anon namespace and static too. Both works.

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


More information about the cfe-commits mailing list