[cfe-users] No macros in DI metadata

Bella V via cfe-users cfe-users at lists.llvm.org
Tue Jul 13 19:00:09 PDT 2021


Thanks David for the helpful information. Is there a way to filter the
predefined macros such as __clang__, __GNUC__, etc.

I could not get the macros defined in my C code with the below code:
DIMacroNodeArray Macros = DICompUnit->getMacros();
for (auto *MN : Macros) {
    if (auto *M = dyn_cast<DIMacro>(MN)) {
        outs()<< M->getName();
    }
}


On Tue, Jul 13, 2021 at 4:13 PM David Blaikie <dblaikie at gmail.com> wrote:

> Add -fdebug-macro
>
> On Tue, Jul 13, 2021 at 4:05 PM Bella V via cfe-users
> <cfe-users at lists.llvm.org> wrote:
> >
> > Hello All,
> >
> > I'm trying to build a list of macros in a compilation unit using
> CU->getMacros().
> > I do not see the macros field in DICompileUnit output.
> > https://godbolt.org/z/b8cM1Yf7v
> >
> > Please let me know what I'm missing.
> >
> > Many Thanks.
> >
> > _______________________________________________
> > cfe-users mailing list
> > cfe-users at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20210713/20ccf7f2/attachment.html>


More information about the cfe-users mailing list