This is an archive of the discontinued LLVM Phabricator instance.

[clang][cli] Parse & generate options necessary for LangOptions defaults manually
ClosedPublic

Authored by jansvoboda11 on Jan 14 2021, 4:52 AM.

Details

Summary

It turns out we need to handle LangOptions separately from the rest of the options. LangOptions used to be conditionally parsed only when !(DashX.getFormat() == InputKind::Precompiled || DashX.getLanguage() == Language::LLVM_IR) and we need to restore this order (for more info, see D94682).

D94682 moves the parsing of marshalled LangOpts from parseSimpleArgs back to ParseLangArgs.

We need to parse marshalled LangOpts after ParseLangArgs calls setLangDefaults. This will enable future patches, where values of some LangOpts depend on the defaults.

However, two language options (-finclude-default-header and -fdeclare-opencl-builtins) need to be parsed before ParseLangArgs calls setLangDefaults, because they are necessary for setting up OpenCL defaults correctly.
This patch implements this by removing their marshalling info and manually parsing (and generating) them exactly where necessary.

Diff Detail

Event Timeline

jansvoboda11 created this revision.Jan 14 2021, 4:52 AM
jansvoboda11 requested review of this revision.Jan 14 2021, 4:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2021, 4:52 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jansvoboda11 edited the summary of this revision. (Show Details)Jan 14 2021, 5:40 AM
jansvoboda11 edited the summary of this revision. (Show Details)Jan 14 2021, 6:13 AM
jansvoboda11 edited the summary of this revision. (Show Details)
jansvoboda11 edited the summary of this revision. (Show Details)
jansvoboda11 edited the summary of this revision. (Show Details)Jan 14 2021, 8:50 AM
jansvoboda11 edited the summary of this revision. (Show Details)
Bigcheese accepted this revision.Jan 14 2021, 8:58 AM

LGTM with the comment.

clang/include/clang/Driver/Options.td
5212–5216

You should add a comment here explaining why these can't be marshaled.

This revision is now accepted and ready to land.Jan 14 2021, 8:58 AM
This revision was landed with ongoing or failed builds.Jan 15 2021, 6:39 AM
This revision was automatically updated to reflect the committed changes.