[clang] Fix error that reference to PointerType is ambiguous in clang/lib/Analysis/UnsafeBufferUsage.cpp (PR #142966)
Abhina Sree via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 5 06:50:16 PDT 2025
https://github.com/abhina-sree updated https://github.com/llvm/llvm-project/pull/142966
>From f536c944cf6526676e5034471ff238b1ce3b0d13 Mon Sep 17 00:00:00 2001
From: Abhina Sreeskantharajan <Abhina.Sreeskantharajan at ibm.com>
Date: Thu, 5 Jun 2025 09:41:54 -0400
Subject: [PATCH] fix error that reference to PointerType is ambiguous
---
clang/lib/Analysis/UnsafeBufferUsage.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index ec648e1a17af9..ecd67c19ee62f 100644
--- a/clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -247,11 +247,11 @@ class MatchDescendantVisitor : public DynamicRecursiveASTVisitor {
// Because we're dealing with raw pointers, let's define what we mean by that.
static bool hasPointerType(const Expr &E) {
- return isa<PointerType>(E.getType().getCanonicalType());
+ return isa<clang::PointerType>(E.getType().getCanonicalType());
}
static bool hasArrayType(const Expr &E) {
- return isa<ArrayType>(E.getType().getCanonicalType());
+ return isa<clang::ArrayType>(E.getType().getCanonicalType());
}
static void
@@ -968,7 +968,8 @@ static bool hasUnsafePrintfStringArg(const CallExpr &Node, ASTContext &Ctx,
if (!FirstParmTy->isPointerType())
return false; // possibly some user-defined printf function
- QualType FirstPteTy = FirstParmTy->castAs<PointerType>()->getPointeeType();
+ QualType FirstPteTy =
+ FirstParmTy->castAs<clang::PointerType>()->getPointeeType();
if (!Ctx.getFILEType()
.isNull() && //`FILE *` must be in the context if it is fprintf
@@ -1052,7 +1053,8 @@ static bool hasUnsafeSnprintfBuffer(const CallExpr &Node,
if (!FirstParmTy->isPointerType())
return false; // Not an snprint
- QualType FirstPteTy = FirstParmTy->castAs<PointerType>()->getPointeeType();
+ QualType FirstPteTy =
+ FirstParmTy->castAs<clang::PointerType>()->getPointeeType();
const Expr *Buf = Node.getArg(0), *Size = Node.getArg(1);
if (FirstPteTy.isConstQualified() || !Buf->getType()->isPointerType() ||
More information about the cfe-commits
mailing list