aaron.ballman added inline comments.

================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:852
+      return false;
+    return this->emitInitGlobalTempComp(TempDecl, E);
   }
----------------
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?


================
Comment at: clang/lib/AST/Interp/Pointer.cpp:235-237
+    for (unsigned I = 0; I != R->getNumFields(); ++I) {
+      const Pointer FieldPtr = this->atField(R->getField(I)->Offset);
+      Result.getStructField(I) = FieldPtr.toRValue(Ctx);
----------------
Pointer to a field? That means, I would like tests that involve bit-fields. :-)


================
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);
----------------



================
Comment at: clang/lib/AST/Interp/Pointer.cpp:241
+    for (unsigned I = 0; I != R->getNumBases(); ++I) {
+      const Pointer BasePtr = this->atField(R->getBase(I)->Offset);
+      Result.getStructBase(I) = BasePtr.toRValue(Ctx);
----------------



================
Comment at: clang/lib/AST/Interp/Record.h:90
   unsigned getNumBases() const { return Bases.size(); }
+  const Base *getBase(unsigned I) const { return &Bases[I]; }
   Base *getBase(unsigned I) { return &Bases[I]; }
----------------
It might make sense to add an assert to both `getBase()` functions to verify 
that `I` is within a valid range.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144457

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

Reply via email to