[clang] 669e508 - [Driver] Fix -f[no-]unwind-tables -Wunused-command-line-argument after 4388b56d525c08ce3cf941cfbad2428b0e1695b0

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 20 20:13:39 PDT 2022


Author: Fangrui Song
Date: 2022-09-20T20:13:30-07:00
New Revision: 669e508772e5e00db6285d699ee82a428dc00f32

URL: https://github.com/llvm/llvm-project/commit/669e508772e5e00db6285d699ee82a428dc00f32
DIFF: https://github.com/llvm/llvm-project/commit/669e508772e5e00db6285d699ee82a428dc00f32.diff

LOG: [Driver] Fix -f[no-]unwind-tables -Wunused-command-line-argument after 4388b56d525c08ce3cf941cfbad2428b0e1695b0

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp
    clang/test/Driver/clang-translation.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index fb64722b44561..4fe68f6896efd 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5469,13 +5469,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   auto SanitizeArgs = TC.getSanitizerArgs(Args);
   auto UnwindTables = TC.getDefaultUnwindTableLevel(Args);
 
+  const bool HasSyncUnwindTables = Args.hasFlag(
+      options::OPT_funwind_tables, options::OPT_fno_unwind_tables, false);
   if (Args.hasFlag(options::OPT_fasynchronous_unwind_tables,
                    options::OPT_fno_asynchronous_unwind_tables,
                    SanitizeArgs.needsUnwindTables()) &&
       !Freestanding)
     UnwindTables = ToolChain::UnwindTableLevel::Asynchronous;
-  else if (Args.hasFlag(options::OPT_funwind_tables,
-                        options::OPT_fno_unwind_tables, false))
+  else if (HasSyncUnwindTables)
     UnwindTables = ToolChain::UnwindTableLevel::Synchronous;
   else if (Args.hasFlag(options::OPT_fno_unwind_tables,
                    options::OPT_fno_asynchronous_unwind_tables,

diff  --git a/clang/test/Driver/clang-translation.c b/clang/test/Driver/clang-translation.c
index ffa732c8f6568..715b0b3150bd9 100644
--- a/clang/test/Driver/clang-translation.c
+++ b/clang/test/Driver/clang-translation.c
@@ -10,7 +10,7 @@
 // I386: "-o"
 // I386: clang-translation
 
-// RUN: %clang -target i386-unknown-unknown -### -S %s -fasynchronous-unwind-tables -fno-unwind-tables 2>&1 | FileCheck --check-prefix=UNWIND-TABLES %s
+// RUN: %clang -target i386-unknown-unknown -### -S %s -fasynchronous-unwind-tables -fno-unwind-tables 2>&1 | FileCheck --check-prefix=UNWIND-TABLES %s --implicit-check-not=warning:
 // UNWIND-TABLES: "-funwind-tables=2"
 
 // RUN: %clang -target i386-apple-darwin9 -### -S %s -o %t.s 2>&1 | \


        


More information about the cfe-commits mailing list