[cfe-dev] Option round-tripping q.

via cfe-dev cfe-dev at lists.llvm.org
Wed May 12 13:36:04 PDT 2021


After the recent refactoring to Clang option handling that introduced
"round-tripping" we had a couple of issues come up with options that
we have defined downstream.  In some cases I believe these showed up 
as test failures and got fixed by adding code to GenerateCodeGenArgs; 
that's fine.  And right now I'm doing the marshalling thing so we can 
remove some local patches to CompilerInvocation (yay!).

But we also had other options that silently weren't propagated, and
we discovered this only by chance.  I would rather have had them show
up as test failures.  This likely points to an inadequacy in our test
coverage, but it brings me to a question:

When round-tripping is enabled, is the re-generated command line
textually compared to the original command line in some way?  If it 
is, I'd have expected it to catch these cases, because some option 
on the original CC1 command line wouldn't be in the re-generated 
command.  But, that didn't happen.

For options that Clang itself does something with, presumably tests
for how the option affects Clang's own behavior would catch issues
(I'm pretty sure that's how we found the cases we did, although I
wasn't the one to do that work).  But in the case of a Clang option 
that just gets passed down to LLVM (through LLVM's TargetOptions, say)
it's not clear there's a good way to test that actually happens.

Thanks,
--paulr



More information about the cfe-dev mailing list