[PATCH] D144457: [clang][Interp] Handle global composite temporaries

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 18 00:58:21 PDT 2023


tbaeder added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:852
+      return false;
+    return this->emitInitGlobalTempComp(TempDecl, E);
   }
----------------
aaron.ballman wrote:
> Should this still happen even if `TempDecl` is null? It looks like `getLifetimeExtendedTemporaryDecl()` can return a null pointer, but perhaps there's a reason we can't get that result here?
AFAIK it never returns null if the storage duration is `SD_Static`, but that's just based on what I was seeing. Could add an assertion to be sure.


================
Comment at: clang/lib/AST/Interp/Pointer.cpp:236
+    for (unsigned I = 0; I != R->getNumFields(); ++I) {
+      const Pointer FieldPtr = this->atField(R->getField(I)->Offset);
+      Result.getStructField(I) = FieldPtr.toRValue(Ctx);
----------------
aaron.ballman wrote:
> 
`const Pointer &` instead? :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144457



More information about the cfe-commits mailing list