NoQ added inline comments.

================
Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1663
     // We can trust a const value or a value of a global initializer in main().
-    const VarDecl *VD = VR->getDecl();
+    const VarDecl *VD = VR->getDecl()->getMostRecentDecl();
     if (VD->getType().isConstQualified() ||
----------------
ASDenysPetrov wrote:
> steakhal wrote:
> > I think you supposed to use the `getCanonicalDecl()` instead.
> Using `getCanonicalDecl` does not fix the issue. I've checked.
Aha ok, can you try iterating over `redecls()`?

Separately, I suspect that this should be performed before the `VarRegion` is 
constructed in the first place. Maybe in its constructor we should 
`assert(VD->isThisDeclarationADefinition())` or something like that.


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

https://reviews.llvm.org/D111542

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to