[clang] [Clang] Rework LTO mode selection to be a Toolchain property (PR #201155)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 2 11:56:14 PDT 2026


================
@@ -462,6 +464,16 @@ class ToolChain {
   /// native LLVM support.
   virtual bool HasNativeLLVMSupport() const;
 
+  /// Returns the default LTO mode for this toolchain.
+  virtual LTOKind getDefaultLTOMode() const;
+
+  /// Resolve the requested LTO mode for this toolchain.
+  LTOKind getLTOMode(const llvm::opt::ArgList &Args,
+                     bool IsOffload = false) const;
+
+  /// Returns true if LTO is active for this toolchain given the args.
+  bool isUsingLTO(const llvm::opt::ArgList &Args, bool IsOffload = false) const;
----------------
jhuber6 wrote:

So you'd rather just take the offloading kind as an argument? Might be a bit simpler to do that check internally, I just figured it wasn't really relevant because we only need the boolean value but I can see the appeal of less on the call site.

https://github.com/llvm/llvm-project/pull/201155


More information about the cfe-commits mailing list