shafik added inline comments.

================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.h:282
+  bool isGlobalDecl(const VarDecl *VD) const {
+    return !VD->hasLocalStorage() || VD->isConstexpr();
+  }
----------------
tbaeder wrote:
> shafik wrote:
> > tbaeder wrote:
> > > shafik wrote:
> > > > Why not `hasGlobalStorage()`?
> > > > 
> > > > Also what is the logic behind `isConstexpr()` check?
> > > Didn't know `isGlobalStorage()` existed ;)
> > > 
> > > Constexpr local variables can be handled like global ones, can't they? 
> > > That was the logic behind it, nothing else. We can save ourselves the 
> > > hassle of local variables in that case.
> > I think I am missing a level of logic here. I don't think of constant 
> > expressions as needing storage nor do I think of them as global variables.
> > 
> > So can you take a step back and explain how this fits in the bigger picture?
> They don't necessarily need storage in the final executable but we create 
> global/local variables for them for bookkeeping, e.g. we need to be able to 
> take their address, track the value, etc.
Ok, will this work for recursive `constexpr` functions with local variables?


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

https://reviews.llvm.org/D136815

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

Reply via email to