[PATCH] D136815: [clang][Interp] Unify visiting variable declarations

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 21 01:48:40 PST 2022


tbaeder added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:1218
+    auto GlobalIndex = P.getGlobal(VD);
+    assert(GlobalIndex); // visitVarDecl() didn't return false.
+    if (!this->emitGetPtrGlobal(*GlobalIndex, VD))
----------------
shafik wrote:
> I don't get the comment.
`P.getGlobal()` must return a global index and not `std::nullopt`, since the `visitVarDecl()` call above did not return `false`. It will return `false` if something failed, but it didn't and so the variable must be allocated already.


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

https://reviews.llvm.org/D136815



More information about the cfe-commits mailing list