[clang] [Clang][Interp] Fix display of syntactically-invalid note for member function calls (PR #102170)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 8 10:07:31 PDT 2024


================
@@ -169,11 +170,32 @@ void InterpFrame::describe(llvm::raw_ostream &OS) const {
       F && (F->isBuiltin() || F->isLambdaStaticInvoker()))
     return;
 
+  const Expr *CallExpr = Caller->getExpr(getRetPC());
   const FunctionDecl *F = getCallee();
-  if (const auto *M = dyn_cast<CXXMethodDecl>(F);
-      M && M->isInstance() && !isa<CXXConstructorDecl>(F)) {
-    print(OS, This, S.getCtx(), S.getCtx().getRecordType(M->getParent()));
-    OS << "->";
+  bool IsMemberCall = isa<CXXMethodDecl>(F) && !isa<CXXConstructorDecl>(F) &&
+                      cast<CXXMethodDecl>(F)->isImplicitObjectMemberFunction();
+  if (getThis().isActive() && IsMemberCall) {
----------------
tbaederr wrote:

```suggestion
  if (Func->hasThisPointer() && IsMemberCall) {
```

`Pointer::isActive()` is about the pointer being active when inside a union.

https://github.com/llvm/llvm-project/pull/102170


More information about the cfe-commits mailing list