[clang] Fix error that reference to PointerType is ambiguous (PR #142966)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 5 06:46:01 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-analysis
Author: Abhina Sree (abhina-sree)
<details>
<summary>Changes</summary>
The CI on my PR https://github.com/llvm/llvm-project/pull/138895 is failing with errors like
`clang/lib/Analysis/UnsafeBufferUsage.cpp:971:45: error: reference to 'PointerType' is ambiguous`
This patch should resolve it by specifying `clang::`
---
Full diff: https://github.com/llvm/llvm-project/pull/142966.diff
1 Files Affected:
- (modified) clang/lib/Analysis/UnsafeBufferUsage.cpp (+4-4)
``````````diff
diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index ec648e1a17af9..e874a483afed5 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,7 @@ 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 +1052,7 @@ 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() ||
``````````
</details>
https://github.com/llvm/llvm-project/pull/142966
More information about the cfe-commits
mailing list