[cfe-dev] warnings are suppressed during 2nd compilation with WrapperFrontendAction()

Ivan Koster via cfe-dev cfe-dev at lists.llvm.org
Thu Feb 25 06:49:28 PST 2016


Hi again,

I have been debugging a long time today and have some more info.

I've pinpointed it down to me calling CI.getDiagnostics().Reset(); in the
function InjectTestSeamRecompile::BeginInvocation(CompilerInstance &CI)

This reset calls:
  DiagStates.clear();
  DiagStatePoints.clear();
  DiagStateOnPushStack.clear();
Which seams to undo all the work that ProcessWarningOptions() did, making
clang forget my command line warning options. Then most of the warnings
fall back to ignored...

Of course I tried the quick way and commented out the Reset() call, but
then Clang immediately crashes when compiling a file.
Can anyone advice me on a solution? Maybe I have to initialize the
DiagnosticsEngine a second time and call ProcessWarningOptions() again?

Kind regards,

Ivan Koster


2016-02-23 17:07 GMT+01:00 Ivan Koster <ivankoster at gmail.com>:

> Hi all,
>
> I have finally made the easy-test-seam tool that I mentioned here:
> http://lists.llvm.org/pipermail/cfe-dev/2014-December/040578.html
>
> I'm really a cpp \ llvm newbie so it was a considerable effort. I've
> borrowed ideas from the FixItRecompile functionality and used
> the WrapperFrontendAction class.
> The easy-test-seam functionality works, the generated code is correct.
> The commit can be found on github here:
> https://github.com/ivankoster/clang/commit/14b48590af28129ba3ffcf647274dd483d0a22dc
>
> The only sad part is:
> I'm generating the AST twice, due to the wrapper action, but the
> diagnostics are not printed for the 2nd AST generation. This is very
> unfortunate, because the first generation of the AST is almost always
> guaranteed to contain warnings, because of the way I designed
> easy-test-seam. (We're essentially assigning a value to an identifier that
> is unassignable, but it becomes assignable in the 2nd generation...) And I
> want to suppress the first set of diagnostics, but let all the diagnostics
> from the 2nd generation through!
>
> Could anyone take a look at my commit and see what I did wrong?
> I've been looking at my code for a few hours now, but my lack of
> experience with the clang codebase is working against me.
>
> Many thanks in advance!
>
> Ivan Koster
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160225/e3f349d9/attachment.html>


More information about the cfe-dev mailing list