View Record Decl in Clang

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

View Record Decl in Clang

Дилян Палаузов via cfe-dev
Hi Clang Devs,

I'm trying to view structs (record decl's) in Clang while compiling a program.

Where exactly in the src code could I view my struct, preferably in the earliest instance possible? My goal is to view a struct, and then view the fields in my struct for some inspection I intend on doing (field decl's).

I also hope to in some manner modify my structs fields, such as swap field positions. I've worked on a team that used a plugin that swapped some field positions in a struct where we figured out alignment/padding issues, but are now looking at doing the same in clang proper. We've been looking at some previous recommendations, but have been looking in RecordLayoutBuilder.cpp as of late, which I'm unsure is the correct location to be trying to swap the field positions.

I'm rather new to the in's and out's of clang/llvm, so any any help would be appreciated.

Thanks

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: View Record Decl in Clang

Дилян Палаузов via cfe-dev
Hello,


Not exactly sure what you want, but you may want to have a look at 

clang::ASTContext::DumpRecordLayout

It will show you the layout of your structure, including padding.


---- Message d'origine ----
De : "Tim Pugh via cfe-dev" <[hidden email]>
À : [hidden email]
Objet : [cfe-dev] View Record Decl in Clang
Date : 06/02/2019 18:58:13 CET

Hi Clang Devs,


I'm trying to view structs (record decl's) in Clang while compiling a program.


Where exactly in the src code could I view my struct, preferably in the earliest instance possible? My goal is to view a struct, and then view the fields in my struct for some inspection I intend on doing (field decl's).


I also hope to in some manner modify my structs fields, such as swap field positions. I've worked on a team that used a plugin that swapped some field positions in a struct where we figured out alignment/padding issues, but are now looking at doing the same in clang proper. We've been looking at some previous recommendations, but have been looking in RecordLayoutBuilder.cpp as of late, which I'm unsure is the correct location to be trying to swap the field positions.


I'm rather new to the in's and out's of clang/llvm, so any any help would be appreciated.


Thanks

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev