This is an archive of the discontinued LLVM Phabricator instance.

[clang][cli] Generate and round-trip Frontend options
ClosedPublic

Authored by jansvoboda11 on Feb 5 2021, 9:44 AM.

Details

Summary

This patch implements generation of remaining frontend options and tests it by performing parse-generate-parse round trip.

Depends on D96269.

Diff Detail

Event Timeline

jansvoboda11 created this revision.Feb 5 2021, 9:44 AM
jansvoboda11 requested review of this revision.Feb 5 2021, 9:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 5 2021, 9:44 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Document getProgramActionOpt

Fix whitespace

jansvoboda11 added inline comments.Feb 8 2021, 8:35 AM
clang/include/clang/Serialization/ModuleFileExtension.h
75

I'm not sure what the best approach is here.

ModuleFileExtension is an abstract class. When parsing command line arguments, we may instantiate its (only) subclass TestModuleFileExtension.
To generate the argument, we can:

  • Add a pure virtual function (e.g. serialize) to ModuleFileExtension, implement it in TestModuleFileExtension and use that in the generator. I'm not sure if introducing the concept of command line and serialization into argument makes sense. For clients subclassing ModuleFileExtension, serialization might not make sense.
  • (The current approach): Add LLVM-style RTTI to the whole hierarchy, and only handle TestModuleFileExtension in the generator by invoking its (non-virtual) serialize.

WDYT would be the best approach here?

dexonsmith accepted this revision.Feb 8 2021, 11:33 AM

LGTM, although the description seems incorrect:

This patch implements generation of remaining preprocessor options and tests it by performing parse-generate-parse round trip.

In fact, this patch is working with frontend options. Please fix for the commit message.

This revision is now accepted and ready to land.Feb 8 2021, 11:33 AM
jansvoboda11 edited the summary of this revision. (Show Details)Feb 9 2021, 12:14 AM

Thanks, a copy-paste mistake.

This revision was landed with ongoing or failed builds.Feb 9 2021, 7:40 AM
This revision was automatically updated to reflect the committed changes.