[PATCH] D135750: [clang][Interp] Track initialization state of local variables

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 22 02:26:06 PST 2022


tbaeder added inline comments.


================
Comment at: clang/lib/AST/Interp/Interp.h:918
     return false;
+  if (!Ptr.isRoot())
+    Ptr.initialize();
----------------
shafik wrote:
> tbaeder wrote:
> > shafik wrote:
> > > Can you explain what is going on here? Why do we need to initialize if it is not root?
> > Root means that `Base == 0`, so it cannot have a `InlineDescriptor` before the `Base` offset. That is mainly the case for global variables.
> Can we add a comment that explains this a little better? I still don't get the significance, so I definitely missing something.
> 
> Also, why do we initialized before the store? 


I don't think there's a significance to the order of operations here, some do the init after the store, some the other way around.


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

https://reviews.llvm.org/D135750



More information about the cfe-commits mailing list