[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 28 01:34:51 PDT 2020


baloghadamsoftware added a comment.

In D77229#2007125 <https://reviews.llvm.org/D77229#2007125>, @NoQ wrote:

> > Yes, indeed very poorly. A C++ operator call is either implemented as CXXOperatorCall or CXXMethodCall randomly. In the former case the this parameter is explicit at the beginning, in the latter case it is implicit.
>
> We have methods on `CallEvent` to handle this, namely `getAdjustedParameterIndex()` and `getASTArgumentIndex()`. They were added in D49443 <https://reviews.llvm.org/D49443>.


Unfortunately, in `ExprEngine::VisitCommonDeclRefExpr` we do not have `CallEvent`, only `CallExpr`.

> These are blocks. They are like lambdas, just different syntax. They aren't part of Objective-C; they're a non-standard extension to C supported by both gcc and clang.
> 
> The line you quoted is not a call, it only defines a block and assigns it into a variable of block pointer type. Here's the full code of the test:
> 
>   358 void testNilReturnWithBlock(Dummy *p) {
>   359   p = 0;
>   360   Dummy *_Nonnull (^myblock)(void) = ^Dummy *_Nonnull(void) {
>   361     return p; // TODO: We should warn in blocks.
>   362   };
>   363   myblock();
>   364 }
>    
> 
> The block is invoked on line 363. Parameter `p` of the surrounding function is accessible from the block because it was captured; it is not a parameter of the block itself.

Sorry, all my studies were about standard things only. Everything else was banned. This is the philosophy of my university, it seems.

What do you suggest, how to retrieve the type for them? We stored the `CallExpr` as `OriginExpr` for the region. Should we store something else in case of blocks, or should we handle this in `getType()`? How to distinguish parameters of the block from the captured parameters of the function? This case sounds very complicated to handle.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77229/new/

https://reviews.llvm.org/D77229





More information about the cfe-commits mailing list