[PATCH] D66423: [analyzer] CastValueChecker: Model isa(), isa_and_nonnull()
Csaba Dabis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 20 19:52:08 PDT 2019
Charusso added a comment.
Thanks for the reviews so far! I had a contradiction in my mind about regions, but now everything is okay and the notes are not misleading.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp:183
+ if (Body)
+ DRE = dyn_cast<DeclRefExpr>(Body);
+
----------------
NoQ wrote:
> A body of a function is always either a `CompoundStmt` or (shockingly) a `CXXTryStmt`. This cast will always fail.
I do not remember what I did here, but that was a working solution.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp:188
+
+ QualType CastToTy = DRE->getTemplateArgs()->getArgument().getAsType();
+ QualType CastFromTy = getRecordType(Call.parameters()[0]->getType());
----------------
NoQ wrote:
> I suspect that `DRE` may still be null (eg., when calling `isa` through function pointer).
>
> I think you should just lookup `Call.getDecl()`'s template arguments instead. It's going to be the declaration of the specific instantiation, so it'll have all the arguments.
That was the plan, just I did not realized I am a `FunctionDecl` away to achieve that. Thanks!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66423/new/
https://reviews.llvm.org/D66423
More information about the cfe-commits
mailing list