[PATCH] D136694: [clang][Interp] Check that constructor calls initialize all record fields

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 1 02:16:05 PST 2022


tbaeder marked 3 inline comments as done.
tbaeder added inline comments.


================
Comment at: clang/lib/AST/Interp/Interp.cpp:447
+
+    if (FieldType->isRecordType()) {
+      Result &= CheckFieldsInitialized(S, OpPC, FieldPtr, FieldPtr.getRecord());
----------------
aaron.ballman wrote:
> Do we have to worry about static data members, or are those excluded in `fields()`?
They aren't in `RecordDecl::fields()`, so aren't in `Record::fields()` either.


================
Comment at: clang/lib/AST/Interp/Interp.h:1346-1347
   if (Func->hasThisPointer()) {
+    ThisPtr = NewFrame->getThis();
     if (!CheckInvoke(S, PC, NewFrame->getThis())) {
       return false;
----------------
aaron.ballman wrote:
> Should we assert that `ThisPtr` is valid?
We could only assert `!isZero()` as far as I understand, but that's part of what `CheckInvoke` does.


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

https://reviews.llvm.org/D136694



More information about the cfe-commits mailing list