diff options
author | Tom Honermann <tom.honermann@intel.com> | 2022-10-01 04:06:58 -0700 |
---|---|---|
committer | Tom Honermann <tom@honermann.net> | 2022-10-03 17:25:44 -0400 |
commit | 4247cdb568eca4c31b14d91105fe5ee140225036 (patch) | |
tree | edc24549c12d4ad47e9f06300ca58f537e34fbbf /llvm/tools/llvm-objdump/llvm-objdump.cpp | |
parent | 69a6417406a1b0316a1fa6aeb63339d0e1d2abbd (diff) | |
download | llvm-4247cdb568eca4c31b14d91105fe5ee140225036.zip llvm-4247cdb568eca4c31b14d91105fe5ee140225036.tar.gz llvm-4247cdb568eca4c31b14d91105fe5ee140225036.tar.bz2 |
[clang]: Add DeclContext::dumpAsDecl().
This change enables a declaration to be conveniently displayed within
a debugger when only a pointer to its DeclContext is available. For example,
in gdb:
(gdb) p Ctx
$1 = (const clang::DeclContext *) 0x14c1a580
(gdb) p Ctx->dumpAsDecl()
ClassTemplateSpecializationDecl 0x14c1a540 <t.cpp:1:1, line:7:1> line:2:8 struct ct
`-TemplateArgument type 'int'
`-BuiltinType 0x14bac420 'int'
$2 = void
In the event that the pointed to DeclContext is invalid (that it has an
invalid DeclKind as a result of a dangling pointer, memory corruption, etc...)
it is not possible to dump its associated declaration. In this case, the
DeclContext will be reported as invalid. For example, in gdb:
(gdb) p Ctx->dumpAsDecl()
DeclContext 0x14c1a580 <unrecognized Decl kind 127>
$3 = void
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
0 files changed, 0 insertions, 0 deletions