[cfe-dev] View Record Decl in Clang

via cfe-dev cfe-dev at lists.llvm.org
Wed Feb 6 10:38:25 PST 2019


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" <cfe-dev at lists.llvm.org>
À : cfe-dev at lists.llvm.org
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
cfe-dev at lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev







More information about the cfe-dev mailing list