Szelethus added inline comments.
================
Comment at:
clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp:435-442
+ const VarDecl *VD;
+ if (const auto *VR =
+ dyn_cast<VarRegion>(cast<SymbolRegionValue>(Sym)->getRegion())) {
+ VD = cast<VarDecl>(VR->getDecl());
+ } else if (const auto *PR =
+ dyn_cast<ParamRegion>(cast<SymbolRegionValue>(Sym)->getRegion()))
{
+ VD = cast<ParmVarDecl>(PR->getDecl());
----------------
baloghadamsoftware wrote:
> Szelethus wrote:
> > Hmm. So, the surrounding code definitely suggests that we're definitely
> > finishing for a parameter here, but it isn't always a parameter region? I
> > know you struggled with this, have you gained any insight as to why?
> Not all regions for `ParmVarDecl` are `ParamRegions`. Exceptions are
> parameters captured by a lambda or a block as well as parameters of functions
> analyzed top-level.
That would be a lovely unit test case! :)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79704/new/
https://reviews.llvm.org/D79704
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits