[cfe-dev] Extracting struct name for typedef struct { ... } <name>

Craig, Ben via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 22 10:56:44 PDT 2016


In the clang padding checker, I use this snippet of code...

     Os << "Excessive padding in '";
     Os << QualType::getAsString(RD->getTypeForDecl(), Qualifiers()) << "'";

RD is a RecordDecl.  I get text like this:

     Excessive padding in 'tstr'


On 8/22/2016 11:44 AM, Himanshu via cfe-dev wrote:
> Hi all,
>
> I tried both RecordDecl  as well as TypedefNameDecl to extract names 
> of such struct declarations, but I always get an empty string. Could 
> you please let me know how to extract the struct name?
>
> For example:
>
> typedef struct {
> ...
> } tstr;
>
> I want to extract 'tstr' name for this struct typedef.
>
> Thanks!
> --
> Himanshu
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160822/4c814987/attachment.html>


More information about the cfe-dev mailing list