[all-commits] [llvm/llvm-project] 791634: [clang][cli] Parse & generate options necessary fo...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Fri Jan 15 06:39:39 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 791634b999e33e029aeeda91eeb5fae13757dcdc
      https://github.com/llvm/llvm-project/commit/791634b999e33e029aeeda91eeb5fae13757dcdc
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2021-01-15 (Fri, 15 Jan 2021)

  Changed paths:
    M clang/include/clang/Driver/Options.td
    M clang/lib/Frontend/CompilerInvocation.cpp

  Log Message:
  -----------
  [clang][cli] Parse & generate options necessary for LangOptions defaults manually

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.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D94678




More information about the All-commits mailing list