r207833 - XCore target: fix handling of -g0 flag

Robert Lytton robert at xmos.com
Fri May 2 02:33:25 PDT 2014


Author: rlytton
Date: Fri May  2 04:33:25 2014
New Revision: 207833

URL: http://llvm.org/viewvc/llvm-project?rev=207833&view=rev
Log:
XCore target: fix handling of -g0 flag

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/xcore-opts.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=207833&r1=207832&r2=207833&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri May  2 04:33:25 2014
@@ -7622,8 +7622,9 @@ void XCore::Assemble::ConstructJob(Compi
   if (Args.hasArg(options::OPT_v))
     CmdArgs.push_back("-v");
 
-  if (Args.hasArg(options::OPT_g_Group))
-    CmdArgs.push_back("-g");
+  if (Arg *A = Args.getLastArg(options::OPT_g_Group))
+    if (!A->getOption().matches(options::OPT_g0))
+      CmdArgs.push_back("-g");
 
   if (Args.hasFlag(options::OPT_fverbose_asm, options::OPT_fno_verbose_asm,
                    false))

Modified: cfe/trunk/test/Driver/xcore-opts.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/xcore-opts.c?rev=207833&r1=207832&r2=207833&view=diff
==============================================================================
--- cfe/trunk/test/Driver/xcore-opts.c (original)
+++ cfe/trunk/test/Driver/xcore-opts.c Fri May  2 04:33:25 2014
@@ -1,6 +1,7 @@
 // RUN: %clang -target xcore %s -g -Wl,L1Arg,L2Arg -Wa,A1Arg,A2Arg -fverbose-asm -v -### -o %t.o 2>&1 | FileCheck %s
 // RUN: %clang -target xcore -x c++ %s -g -Wl,L1Arg,L2Arg -Wa,A1Arg,A2Arg -fverbose-asm -v -### -o %t.o 2>&1 | FileCheck %s
 // RUN: %clang -target xcore -x c++ %s -fexceptions -### -o %t.o 2>&1 | FileCheck -check-prefix CHECK-EXCEP %s
+// RUN: %clang -target xcore %s -g0 -### -o %t.o 2>&1 | FileCheck -check-prefix CHECK-G0 %s
 
 // CHECK: "-nostdsysteminc"
 // CHECK: "-momit-leaf-frame-pointer"
@@ -27,3 +28,7 @@
 // CHECK-EXCEP: xcc" "-o"
 // CHECK-EXCEP: "-fexceptions"
 
+// CHECK-G0: xcc"
+// CHECK-G0-NOT: "-g"
+// CHECK-G0: xcc"
+





More information about the cfe-commits mailing list