This is an archive of the discontinued LLVM Phabricator instance.

[clang-import-test] Option to dump the IR for an expression
ClosedPublic

Authored by spyffe on Aug 7 2017, 2:36 PM.

Details

Summary

This adds the argument --dump-ir to clang-import-test, which allows viewing of the final IR. This is useful for confirming that structure layout was correct.

I've added an XFAILed test that exercises this, checking that a struct defined inside a function body has the right fields. Currently it does not because LookupSameContext() (ExternalASTMerger.cpp) can't find the struct. This is an issue I intend to resolve separately.

Diff Detail

Event Timeline

spyffe created this revision.Aug 7 2017, 2:36 PM
spyffe updated this revision to Diff 110093.Aug 7 2017, 2:43 PM

Added a passing test for a global struct, so we have something that'll fail if the IR dumping breaks.

spyffe updated this revision to Diff 110095.Aug 7 2017, 2:47 PM

Eliminate sensitive dependence on sizeof(int). bool should still be rendered as i1 though.

lhames accepted this revision.Aug 7 2017, 3:05 PM

LGTM!

tools/clang-import-test/clang-import-test.cpp
301–303

LLVM style says no braces for single line conditionals. :)

This revision is now accepted and ready to land.Aug 7 2017, 3:05 PM
This revision was automatically updated to reflect the committed changes.