]> granicus.if.org Git - clang/commitdiff
[CUDA] Add --no-cuda-noopt-debug, which disables --cuda-noopt-debug.
authorJustin Lebar <jlebar@google.com>
Tue, 19 Apr 2016 02:27:11 +0000 (02:27 +0000)
committerJustin Lebar <jlebar@google.com>
Tue, 19 Apr 2016 02:27:11 +0000 (02:27 +0000)
Reviewers: tra

Subscribers: cfe-commits, jhen

Differential Revision: http://reviews.llvm.org/D19251

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266708 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Options.td
lib/Driver/Tools.cpp
test/Driver/cuda-external-tools.cu

index 9c625a0cff750c4b9e7d607e844de7301da75e74..946f29dec39f1d6769acb0381c0ce673d529e01b 100644 (file)
@@ -386,6 +386,7 @@ def cuda_gpu_arch_EQ : Joined<["--"], "cuda-gpu-arch=">, Flags<[DriverOption]>,
   HelpText<"CUDA GPU architecture (e.g. sm_35).  May be specified more than once.">;
 def cuda_noopt_device_debug : Flag<["--"], "cuda-noopt-device-debug">,
   HelpText<"Enable device-side debug info generation. Disables ptxas optimizations.">;
+def no_cuda_noopt_device_debug : Flag<["--"], "no-cuda-noopt-device-debug">;
 def cuda_path_EQ : Joined<["--"], "cuda-path=">, Group<i_Group>,
   HelpText<"CUDA installation path">;
 def fcuda_flush_denormals_to_zero : Flag<["-"], "fcuda-flush-denormals-to-zero">,
index 75424e870066722d29a053709269fd6c5936b8a4..4dd860227ddafede91460f4b10ac875dedcdcf0f 100644 (file)
@@ -10956,7 +10956,8 @@ void NVPTX::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
 
   ArgStringList CmdArgs;
   CmdArgs.push_back(TC.getTriple().isArch64Bit() ? "-m64" : "-m32");
-  if (Args.getLastArg(options::OPT_cuda_noopt_device_debug)) {
+  if (Args.hasFlag(options::OPT_cuda_noopt_device_debug,
+                   options::OPT_no_cuda_noopt_device_debug, false)) {
     // ptxas does not accept -g option if optimization is enabled, so
     // we ignore the compiler's -O* options if we want debug info.
     CmdArgs.push_back("-g");
index 7a6396078915e9f43a914402f1b923dcbfd42f76..280c60966bd0e4d9c5810077393492bc09e4c34e 100644 (file)
 // RUN: %clang -### -target x86_64-linux-gnu --cuda-noopt-device-debug -O2 -c %s 2>&1 \
 // RUN: | FileCheck -check-prefix ARCH64 -check-prefix SM20 -check-prefix DBG %s
 
+// --no-cuda-noopt-device-debug overrides --cuda-noopt-device-debug.
+// RUN: %clang -### -target x86_64-linux-gnu --cuda-noopt-debug \
+// RUN:   --no-cuda-noopt-debug -O2 -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix ARCH64 -check-prefix SM20 -check-prefix OPT2 %s
+
 // Regular compile without -O.  This should result in us passing -O0 to ptxas.
 // RUN: %clang -### -target x86_64-linux-gnu -c %s 2>&1 \
 // RUN: | FileCheck -check-prefix ARCH64 -check-prefix SM20 -check-prefix OPT0 %s