This is an archive of the discontinued LLVM Phabricator instance.

[clang][codegen] Set CurLinkModule in CodeGenAction::ExecuteAction
ClosedPublic

Authored by inglorion on Aug 23 2021, 6:01 PM.

Details

Summary

CodeGenAction::ExecuteAction creates a BackendConsumer for the
purpose of handling diagnostics. The BackendConsumer's
DiagnosticHandlerImpl method expects CurLinkModule to be set,
but this did not happen on the code path that goes through
ExecuteAction. This change makes it so that the BackendConsumer
constructor used by ExecuteAction requires the Module to be
specified and passes the appropriate module in ExecuteAction.

The change also adds a test that fails without this change
and passes with it. To make the test work, the FIXME in the
handling of DK_Linker diagnostics was addressed so that warnings
and notes are no longer silently discarded. Since this introduces
a new warning diagnostic, a flag to control it (-Wlinker-warnings)
has also been added.

Diff Detail

Event Timeline

inglorion requested review of this revision.Aug 23 2021, 6:01 PM
inglorion created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2021, 6:01 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
xur accepted this revision.Aug 24 2021, 10:32 AM

Thanks for fix this!
I like this fix and the patch looks good to me.

-Rong

This revision is now accepted and ready to land.Aug 24 2021, 10:32 AM