[PATCH] D103825: [clang] Do not crash when ArgTy is null in CheckArgAlignment
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 8 03:39:35 PDT 2021
kadircet added inline comments.
================
Comment at: clang/lib/Sema/SemaChecking.cpp:4567
if (ParamTy->isPointerType())
ArgTy = ArgTy->getPointeeType();
----------------
i think ArgTy becomes null after this operation. e.g. the function requires a pointer param, user provides a non-pointer arg in a context where recovery exprs would keep the ast call attached.
I've also spent quite some time trying to reproduce but no luck.
================
Comment at: clang/lib/Sema/SemaChecking.cpp:4657
// Args[ArgIdx] can be null in malformed code.
if (const Expr *Arg = Args[ArgIdx]) {
QualType ParamTy = Proto->getParamType(ArgIdx);
----------------
i think before diving in here we should ensure this `Expr` doesn't have type or error dependence.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103825/new/
https://reviews.llvm.org/D103825
More information about the cfe-commits
mailing list