[clang] 523640f - [clang][Interp][NFC] Use qualified name in Function::getName()
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 28 06:54:51 PST 2023
Author: Timm Bäder
Date: 2023-02-28T15:54:25+01:00
New Revision: 523640f7a4c0b038ce630939af161fdfa964dba4
URL: https://github.com/llvm/llvm-project/commit/523640f7a4c0b038ce630939af161fdfa964dba4
DIFF: https://github.com/llvm/llvm-project/commit/523640f7a4c0b038ce630939af161fdfa964dba4.diff
LOG: [clang][Interp][NFC] Use qualified name in Function::getName()
Added:
Modified:
clang/lib/AST/Interp/Disasm.cpp
clang/lib/AST/Interp/Function.h
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/Disasm.cpp b/clang/lib/AST/Interp/Disasm.cpp
index 1c95782536fba..7a5da90cd9002 100644
--- a/clang/lib/AST/Interp/Disasm.cpp
+++ b/clang/lib/AST/Interp/Disasm.cpp
@@ -34,14 +34,7 @@ template <typename T> inline T ReadArg(Program &P, CodePtr &OpPC) {
LLVM_DUMP_METHOD void Function::dump() const { dump(llvm::errs()); }
LLVM_DUMP_METHOD void Function::dump(llvm::raw_ostream &OS) const {
- if (F) {
- if (const auto *MD = dyn_cast<CXXMethodDecl>(F))
- OS << MD->getParent()->getDeclName() << "::";
- OS << F->getDeclName() << " " << (const void *)this << ":\n";
- } else {
- OS << "<<expr>>\n";
- }
-
+ OS << getName() << " " << (const void *)this << "\n";
OS << "frame size: " << getFrameSize() << "\n";
OS << "arg size: " << getArgSize() << "\n";
OS << "rvo: " << hasRVO() << "\n";
diff --git a/clang/lib/AST/Interp/Function.h b/clang/lib/AST/Interp/Function.h
index 434c3f7b0defd..1eb4fa90d7943 100644
--- a/clang/lib/AST/Interp/Function.h
+++ b/clang/lib/AST/Interp/Function.h
@@ -90,7 +90,12 @@ class Function final {
/// Returns the name of the function decl this code
/// was generated for.
- const std::string getName() const { return F->getNameInfo().getAsString(); }
+ const std::string getName() const {
+ if (!F)
+ return "<<expr>>";
+
+ return F->getQualifiedNameAsString();
+ }
/// Returns the location.
SourceLocation getLoc() const { return Loc; }
More information about the cfe-commits
mailing list