View Record Decl in Clang

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