[PATCH] D79704: [Analyzer] [NFC] Parameter Regions

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 14 05:20:32 PDT 2020


NoQ added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/MemRegion.cpp:191
+const ParmVarDecl *ParamRegion::getDecl() const {
+  const Decl *D = getStackFrame()->getDecl();
+
----------------
baloghadamsoftware wrote:
> NoQ wrote:
> > This doesn't work when the callee is unknown.
> Please give me an example where the callee is unknown. As I wrote, originally I put a `getExpr()` method here as well and `getType()` fell back to it if it could not find the `Decl()`. However, it was never invoked on the whole test suite. (I put an `assert(false)` into it, and did not get a crash.
> Please give me an example where the callee is unknown.

>>! In D79704#2034571, @NoQ wrote:
>>>! In D79704#2032947, @Szelethus wrote:
>> Could you give a specific code example? 
> 
> ```lang=c++
> struct S {
>   S() {
>     this; // What region does 'this' point to...
>   }
> };
> 
> void foo(void (*bar)(S)) {
>   bar(S()); // ...in this invocation?
> }
> ```


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

https://reviews.llvm.org/D79704





More information about the cfe-commits mailing list