[all-commits] [llvm/llvm-project] 39a2a2: [clang][cli] Parse Lang and CodeGen options separa...
Jan Svoboda via All-commits
all-commits at lists.llvm.org
Tue Jan 19 00:57:24 PST 2021
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 39a2a233f88443e865758ba73c156787c77ead2c
https://github.com/llvm/llvm-project/commit/39a2a233f88443e865758ba73c156787c77ead2c
Author: Jan Svoboda <jan_svoboda at apple.com>
Date: 2021-01-19 (Tue, 19 Jan 2021)
Changed paths:
M clang/include/clang/Driver/Options.td
M clang/include/clang/Frontend/CompilerInvocation.h
M clang/lib/Frontend/CompilerInvocation.cpp
M clang/test/Frontend/diagnostics-order.c
Log Message:
-----------
[clang][cli] Parse Lang and CodeGen options separately
This patch moves the parsing of `{Lang,CodeGen}Options` from `parseSimpleArgs` to the original `Parse{Lang,CodeGen}Args` functions.
This ensures all marshalled `LangOptions` are being parsed **after** the call `setLangDefaults`, which in turn enables us to marshall `LangOptions` that somehow depend on the defaults. (In a future patch.)
Now, `CodeGenOptions` need to be parsed **after** `LangOptions`, because `-cl-mad-enable` (a `CodeGenOpt`) depends on the value of `-cl-fast-relaxed-math` and `-cl-unsafe-math-optimizations` (`LangOpts`).
Unfortunately, this removes the nice property that marshalled options get parsed in the exact order they appear in the `.td` file. Now we cannot be sure that a TableGen record referenced in `ImpliedByAnyOf` has already been parsed. This might cause an ordering issues (i.e. reading value of uninitialized variable). I plan to mitigate this by moving each `XxxOpt` group from `parseSimpleArgs` back to their original parsing function. With this setup, if an option from group `A` references option from group `B` in TableGen, the compiler will require us to make the `CompilerInvocation` member for `B` visible in the parsing function for `A`. That's where we notice that `B` didn't get parsed yet.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D94682
More information about the All-commits
mailing list