[cfe-dev] How to get the namespace name from a clang::CXXRecordDecl?

Yafei Liu via cfe-dev cfe-dev at lists.llvm.org
Fri Jul 31 01:49:22 PDT 2020


Hi Stephan, I'm sorry I tried some combinations of APIs in getDeclContext,
which are related to namespace, but failed, can you show me some examples
or related documents?

On Fri, Jul 31, 2020 at 4:32 PM Stephan Bergmann <sbergman at redhat.com>
wrote:

> On 31/07/2020 10:25, Yafei Liu via cfe-dev wrote:
> > I'm using an AST matcher to get some `clang::CXXRecordDecl`s, and now I
> > want to get the namespace of that record, but I searched all the apis
> > and cannot find one.
>
> such information is recorded in the DeclContext chain, reachable via
> Decl::getDeclContext
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200731/2672420f/attachment.html>


More information about the cfe-dev mailing list