This is an archive of the discontinued LLVM Phabricator instance.

[C++20][Modules][HU 5/5] Add fdirectives-only mode for preprocessing output.
ClosedPublic

Authored by iains on Mar 7 2022, 2:29 AM.

Details

Summary

When the -fdirectives-only option is used together with -E, the preprocessor
output reflects evaluation of if/then/else directives.

As such, it preserves defines and undefs of macros that are still live after
such processing. The intent is that this output could be consumed as input
to generate considered a C++20 header unit.

We strip out any (unused) defines that come from built-in, built-in-file or
command line; these are re-added when the preprocessed source is consumed.

Diff Detail

Event Timeline

iains created this revision.Mar 7 2022, 2:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2022, 2:29 AM
Herald added a subscriber: dang. · View Herald Transcript
iains published this revision for review.Mar 7 2022, 4:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2022, 4:39 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
iains updated this revision to Diff 414892.Mar 12 2022, 3:22 PM

rebased.

iains updated this revision to Diff 416850.Mar 21 2022, 1:36 AM

rebased.

urnathan accepted this revision.Mar 23 2022, 5:03 AM

Kind of surprised this wasn't already a thing :)

This revision is now accepted and ready to land.Mar 23 2022, 5:03 AM
iains updated this revision to Diff 418083.Mar 24 2022, 4:43 PM

rebased