================ @@ -784,12 +786,12 @@ AST_MATCHER_P(CallExpr, hasUnsafePrintfStringArg, return false; // possibly some user-defined printf function ASTContext &Ctx = Finder->getASTContext(); - QualType FristParmTy = FD->getParamDecl(0)->getType(); + QualType FirstParmTy = FD->getParamDecl(0)->getType(); - if (!FristParmTy->isPointerType()) + if (!FirstParmTy->isPointerType()) return false; // possibly some user-defined printf function - QualType FirstPteTy = (cast<PointerType>(FristParmTy))->getPointeeType(); + QualType FirstPteTy = FirstParmTy->getAs<PointerType>()->getPointeeType(); ---------------- ziqingluo-90 wrote:
The difference between `castAs` and `getAs` is that `castAs` asserts the canonical type is `PointerType` while `getAs` returns null if not. I think `castAs` is more suitable for our case. https://github.com/llvm/llvm-project/pull/109496 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits