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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 30 10:07:26 PST 2022


aaron.ballman added inline comments.


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


================
Comment at: clang/lib/AST/Interp/Interp.h:1346-1347
   if (Func->hasThisPointer()) {
+    ThisPtr = NewFrame->getThis();
     if (!CheckInvoke(S, PC, NewFrame->getThis())) {
       return false;
----------------
Should we assert that `ThisPtr` is valid?


================
Comment at: clang/lib/AST/Interp/Interp.h:1365-1368
+    if (Func->isConstructor()) {
+      if (!CheckCtorCall(S, PC, ThisPtr))
+        return false;
+    }
----------------



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

https://reviews.llvm.org/D136694



More information about the cfe-commits mailing list