[clang] f2f8c25 - [clang][Interp][NFC] Print parent class name of methods

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 27 00:21:34 PST 2023


Author: Timm Bäder
Date: 2023-01-27T09:04:14+01:00
New Revision: f2f8c25540753a8be375fc90ad703d4101562342

URL: https://github.com/llvm/llvm-project/commit/f2f8c25540753a8be375fc90ad703d4101562342
DIFF: https://github.com/llvm/llvm-project/commit/f2f8c25540753a8be375fc90ad703d4101562342.diff

LOG: [clang][Interp][NFC] Print parent class name of methods

in Function::dump().

Added: 
    

Modified: 
    clang/lib/AST/Interp/Disasm.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Disasm.cpp b/clang/lib/AST/Interp/Disasm.cpp
index d362ccdc7328..1c95782536fb 100644
--- a/clang/lib/AST/Interp/Disasm.cpp
+++ b/clang/lib/AST/Interp/Disasm.cpp
@@ -35,13 +35,9 @@ LLVM_DUMP_METHOD void Function::dump() const { dump(llvm::errs()); }
 
 LLVM_DUMP_METHOD void Function::dump(llvm::raw_ostream &OS) const {
   if (F) {
-    if (auto *Cons = dyn_cast<CXXConstructorDecl>(F)) {
-      DeclarationName Name = Cons->getParent()->getDeclName();
-      OS << Name << "::" << Name;
-    } else {
-      OS << F->getDeclName();
-    }
-    OS << " " << (const void*)this << ":\n";
+    if (const auto *MD = dyn_cast<CXXMethodDecl>(F))
+      OS << MD->getParent()->getDeclName() << "::";
+    OS << F->getDeclName() << " " << (const void *)this << ":\n";
   } else {
     OS << "<<expr>>\n";
   }


        


More information about the cfe-commits mailing list