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

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 14 06:58:18 PDT 2020


baloghadamsoftware marked an inline comment as done.
baloghadamsoftware added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/MemRegion.cpp:191
+const ParmVarDecl *ParamRegion::getDecl() const {
+  const Decl *D = getStackFrame()->getDecl();
+
----------------
NoQ wrote:
> 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?
> > }
> > ```
OK, but it still does not crash the analyzer, even if I enable creation of stack frames for all the callees, even for those without definition. What else should I do to enforce the crash (null pointer dereference)? Try to use `getParameterLocation()` in a unit test?


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

https://reviews.llvm.org/D79704





More information about the cfe-commits mailing list