[clang] 96a50e0 - [Clang] Accept `-flto=none` similar to `-fno-lto` (#201460)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 3 16:46:13 PDT 2026
Author: Joseph Huber
Date: 2026-06-03T18:46:09-05:00
New Revision: 96a50e0ee0959dd3095b0d3c561fab0c5f5fe94c
URL: https://github.com/llvm/llvm-project/commit/96a50e0ee0959dd3095b0d3c561fab0c5f5fe94c
DIFF: https://github.com/llvm/llvm-project/commit/96a50e0ee0959dd3095b0d3c561fab0c5f5fe94c.diff
LOG: [Clang] Accept `-flto=none` similar to `-fno-lto` (#201460)
Summary:
Personal preference, but I would like to be able to set all the LTO
kinds from the string, and it feels a little odd to need to use
`-fno-lto` to override the mode.
Added:
Modified:
clang/lib/Driver/ToolChain.cpp
clang/test/Driver/lto.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 82c4a7a34e47f..ccfc022f79427 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -1347,6 +1347,7 @@ static LTOKind parseLTOMode(const llvm::opt::ArgList &Args,
return llvm::StringSwitch<LTOKind>(LTOName)
.Case("full", LTOK_Full)
.Case("thin", LTOK_Thin)
+ .Case("none", LTOK_None)
.Default(LTOK_Unknown);
}
diff --git a/clang/test/Driver/lto.c b/clang/test/Driver/lto.c
index a85f953af37a8..81165d3b9e8a3 100644
--- a/clang/test/Driver/lto.c
+++ b/clang/test/Driver/lto.c
@@ -46,6 +46,8 @@
// RUN: -fuse-ld=lld -flto -### 2>&1 | FileCheck --check-prefix=NO-LLVMGOLD %s
// RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \
// RUN: -fuse-ld=gold -flto -fno-lto -### 2>&1 | FileCheck --check-prefix=NO-LLVMGOLD %s
+// RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \
+// RUN: -fuse-ld=gold -flto -flto=none -### 2>&1 | FileCheck --check-prefix=NO-LLVMGOLD %s
// NO-LLVMGOLD-NOT: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
// RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \
More information about the cfe-commits
mailing list