[clang] 8dc4385 - [Driver] Accept -fno-lto in clang-cl

Arthur Eubanks via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 5 12:24:45 PDT 2020


Author: Arthur Eubanks
Date: 2020-08-05T12:24:10-07:00
New Revision: 8dc43852e4a8a5c6680d52aa6e73a75aef5a5954

URL: https://github.com/llvm/llvm-project/commit/8dc43852e4a8a5c6680d52aa6e73a75aef5a5954
DIFF: https://github.com/llvm/llvm-project/commit/8dc43852e4a8a5c6680d52aa6e73a75aef5a5954.diff

LOG: [Driver] Accept -fno-lto in clang-cl

Some compiler-rt tests check for the presence of the compiler accepting
-fno-lto to add that flag. Otherwise some tests don't link due to
-flto mismatch between compiling and linking.

$ cmake ... -DLLVM_ENABLE_LTO=Thin ...
$ ninja projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-x86_64-Test.exe
previously failed, now links.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D85252

Added: 
    

Modified: 
    clang/include/clang/Driver/Options.td
    clang/test/Driver/cl-options.c

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index fcb5c030755e..786a3c362842 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1351,7 +1351,7 @@ def flto_EQ : Joined<["-"], "flto=">, Flags<[CoreOption, CC1Option]>, Group<f_Gr
   HelpText<"Set LTO mode to either 'full' or 'thin'">, Values<"thin,full">;
 def flto : Flag<["-"], "flto">, Flags<[CoreOption, CC1Option]>, Group<f_Group>,
   HelpText<"Enable LTO in 'full' mode">;
-def fno_lto : Flag<["-"], "fno-lto">, Group<f_Group>,
+def fno_lto : Flag<["-"], "fno-lto">, Flags<[CoreOption, CC1Option]>, Group<f_Group>,
   HelpText<"Disable LTO mode (default)">;
 def flto_jobs_EQ : Joined<["-"], "flto-jobs=">,
   Flags<[CC1Option]>, Group<f_Group>,

diff  --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index d0c48ae41d9a..bc4cab0f949f 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -586,6 +586,9 @@
 // RUN: %clang_cl -### /c -flto -- %s 2>&1 | FileCheck -check-prefix=LTO %s
 // LTO: -flto
 
+// RUN: %clang_cl -### /c -flto -fno-lto -- %s 2>&1 | FileCheck -check-prefix=LTO-NO %s
+// LTO-NO-NOT: "-flto"
+
 // RUN: %clang_cl -### /c -flto=thin -- %s 2>&1 | FileCheck -check-prefix=LTO-THIN %s
 // LTO-THIN: -flto=thin
 


        


More information about the cfe-commits mailing list