[PATCH] D142630: [clang][Interp] Implement virtual function calls

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 1 07:10:57 PST 2023


aaron.ballman added a comment.

(Still thinking about the implementation work here, mostly just drive-by comments at the moment. My gut instinct is that we've not got sufficient test coverage here, but that might be partially because of other parts of the interpreter not being ready yet.)



================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:1692-1699
+    if (const auto *ME = dyn_cast<MemberExpr>(E->getCallee());
+        ME && ME->hasQualifier())
+      HasQualifier = true;
+
+    bool IsVirtual = false;
+    if (const auto *MD = dyn_cast<CXXMethodDecl>(FuncDecl);
+        MD && MD->isVirtual())
----------------
Might as well simplify these a little bit.


================
Comment at: clang/lib/AST/Interp/Interp.h:1546-1547
+      ThisPtr.getDeclDesc()->getType()->getAsCXXRecordDecl();
+  const CXXRecordDecl *StaticDecl = cast<CXXRecordDecl>(Func->getParentDecl());
+  const CXXMethodDecl *InitialFunction = cast<CXXMethodDecl>(Func->getDecl());
+  const CXXMethodDecl *Overrider = S.getContext().getOverridingFunction(
----------------



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

https://reviews.llvm.org/D142630



More information about the cfe-commits mailing list