[all-commits] [llvm/llvm-project] c495df: [clang][cli] NFC: Decrease the scope of ParseLangA...
Jan Svoboda via All-commits
all-commits at lists.llvm.org
Fri Jan 15 00:07:54 PST 2021
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: c495dfe0268bc2be8737725d657411baa1399e9d
https://github.com/llvm/llvm-project/commit/c495dfe0268bc2be8737725d657411baa1399e9d
Author: Jan Svoboda <jan_svoboda at apple.com>
Date: 2021-01-15 (Fri, 15 Jan 2021)
Changed paths:
M clang/include/clang/Frontend/CompilerInvocation.h
M clang/lib/Frontend/CompilerInvocation.cpp
Log Message:
-----------
[clang][cli] NFC: Decrease the scope of ParseLangArgs parameters
Instead of passing the whole `TargetOptions` and `PreprocessorOptions` to `ParseLangArgs` give it only the necessary members.
This makes tracking the dependencies between various parsers and option groups easier.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D94674
Commit: 1a49944b59dbbfd62bd860b564919087f274a5bf
https://github.com/llvm/llvm-project/commit/1a49944b59dbbfd62bd860b564919087f274a5bf
Author: Jan Svoboda <jan_svoboda at apple.com>
Date: 2021-01-15 (Fri, 15 Jan 2021)
Changed paths:
M clang/lib/Frontend/CompilerInvocation.cpp
Log Message:
-----------
[clang][cli] NFC: Decrease the scope of ParseCodeGenArgs parameters
Instead of passing the whole `TargetOptions` and `FrontendOptions` to `ParseCodeGenArgs` give it only the necessary members.
This makes tracking the dependencies between various parsers and option groups easier.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D94675
Commit: b6575bfd0eeb5a364dd2e4f4a2e461679da1f8a9
https://github.com/llvm/llvm-project/commit/b6575bfd0eeb5a364dd2e4f4a2e461679da1f8a9
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
M llvm/include/llvm/Option/OptParser.td
M llvm/unittests/Option/OptionMarshallingTest.cpp
M llvm/unittests/Option/Opts.td
Log Message:
-----------
[clang][cli] Specify KeyPath prefixes via TableGen classes
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).
We could do this similarly to how `DiagnosticOptions` are handled: via a counterpart to the `IsDiag` mix-in (e.g. `IsLang`). These mix-ins would prefix the option key path with the appropriate `CompilerInvocation::XxxOpts` member. However, this solution would be problematic, as we'd now have two kinds of options (`Lang` and `Diag`) with seemingly incomplete key paths in the same file. To understand what `CompilerInvocation` member an option affects, one would need to read the whole option definition and notice the `IsDiag` or `IsLang` class.
Instead, this patch introduces more robust way to handle different kinds of options separately: via the `KeyPathAndMacroPrefix` class. We have one specialization of that class per `CompilerInvocation` member (e.g. `LangOpts`, `DiagnosticOpts`, etc.). Now, instead of specifying a key path with `"LangOpts->UndefPrefixes"`, we use `LangOpts<"UndefPrefixes">`. This keeps the readability intact (you don't have to look for the `IsLang` mix-in, the key path is complete on its own) and allows us to specify a custom macro prefix within `LangOpts`.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D94676
Compare: https://github.com/llvm/llvm-project/compare/5508516b0663...b6575bfd0eeb
More information about the All-commits
mailing list