Clang++ 3.4 -fdump-record-layouts not producing any results?

I’m trying to dump the record layout on Xubuntu 13.04, using official APT binaries for latest stable 3.4. Unfortunately, it doesn’t seem to produce any results, as you can see from the following trivial example. Am I doing it wrong?

$ cat
class Tester {
int foo;

int main() {
Tester test;
return 0;
$ clang -cc1 -v -fdump-record-layouts
clang -cc1 version 3.4 based upon LLVM 3.4 default target x86_64-pc-linux-gnu
#include “…” search starts here:
End of search list.

You need to get it to generate some IR, try the following:
$ clang -cc1 -x c++ -v -fdump-record-layouts -emit-llvm -o /dev/null

The -cc1 command appears to default to -fsyntax-only, so you want to pass -emit-llvm-only or -emit-obj. If you do -fsyntax-only, we don’t have to compute record layout in your example, so we don’t dump it.

Thanks, guys. -emit-llvm-only seems to do the trick, with the added benefit of suppressing the generation of object files.

Where are these flags documented? I looked through both man clang and the online User Manual[1], and neither mentioned those flags.


cc1 flags are not documented, including -fdump-record-layouts. Go figure. :slight_smile: