-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Fix error that reference to PointerType is ambiguous in clang/lib/Analysis/UnsafeBufferUsage.cpp #142966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-analysis Author: Abhina Sree (abhina-sree) ChangesThe CI on my PR #138895 is failing with errors like
This patch should resolve it by specifying Full diff: https://github.com/llvm/llvm-project/pull/142966.diff 1 Files Affected:
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() ||
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
4850d42
to
f536c94
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I would also consider dropping the "using namespace llvm" instead. This seems a bit unusual for a file in clang/lib/Analysis.
Thanks! I've implemented your suggested solution instead |
…lysis/UnsafeBufferUsage.cpp (llvm#142966) The CI on my PR llvm#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 removing `using namespace llvm`
…lysis/UnsafeBufferUsage.cpp (llvm#142966) The CI on my PR llvm#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 removing `using namespace llvm`
The CI on my PR #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 removing
using namespace llvm