[clang] [lld] [llvm] [llvm][lld][clang] Delay initializing TargetOptions in LTO builds until a Triple is available (PR #179509)
Alexander Richardson via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 12 05:54:56 PST 2026
================
@@ -47,7 +47,9 @@ struct Config {
// Note: when adding fields here, consider whether they need to be added to
// computeLTOCacheKey in LTO.cpp.
std::string CPU;
- TargetOptions Options;
+ // Callback to modify the target options once they are instantiated.
+ std::function<void(TargetOptions &Options)> ModifyTargetOptions =
+ [](TargetOptions &) {};
----------------
arichardson wrote:
```suggestion
std::function<TargetOptions(const Triple &TT)> InitTargetOptions =
[](const Triple &TT) {
codegen::InitTargetOptionsFromCodeGenFlags(TT)
};
```
Would this kind of hook be more flexible (probably need to push the initilization of this variable into a .cpp file we do this)
https://github.com/llvm/llvm-project/pull/179509
More information about the cfe-commits
mailing list