summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-06-21 08:22:39 +0000
committerAlexey Samsonov <samsonov@google.com>2012-06-21 08:22:39 +0000
commitf50a9ffd0bea49afc0cfcea588dc73962cc7ba3a (patch)
treeb274c39acc7332ae34cf8c17dd3a4f1abcee045f /clang/test
parentf8947a33603dce97057071d9ed6a4320df6d9766 (diff)
downloadbcm5719-llvm-f50a9ffd0bea49afc0cfcea588dc73962cc7ba3a.tar.gz
bcm5719-llvm-f50a9ffd0bea49afc0cfcea588dc73962cc7ba3a.zip
Improve support for -g options accepted by Clang:
1. Accept flags -g[0-3], -ggdb[0-3], -gdwarf-[2-4] and collapse them to simple -g (except -g0/-ggdb0). 2. Produce driver error on unsupported formats (-gcoff, -gstabs, -gvms) and options (-gtoggle). 3. Recognize and ignore flags -g[no-]strict-dwarf, -g[no-]record-gcc-switches. llvm-svn: 158906
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Driver/debug-options.c66
-rw-r--r--clang/test/Driver/debug-unsupported.c13
2 files changed, 43 insertions, 36 deletions
diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c
index 76fcb7b56a9..bdeb6cad918 100644
--- a/clang/test/Driver/debug-options.c
+++ b/clang/test/Driver/debug-options.c
@@ -2,49 +2,43 @@
// rdar://10383444
// RUN: %clang -### -c -g %s 2>&1 | FileCheck -check-prefix=G %s
-// RUN: %clang -### -c -g2 %s 2>&1 | FileCheck -check-prefix=G2 %s
-// RUN: %clang -### -c -g3 %s 2>&1 | FileCheck -check-prefix=G3 %s
-// RUN: %clang -### -c -ganything %s 2>&1 | FileCheck -check-prefix=GANY %s
-// RUN: %clang -### -c -ggdb %s 2>&1 | FileCheck -check-prefix=GGDB %s
-// RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=GFOO %s
-// RUN: %clang -### -c -g -g0 %s 2>&1 | FileCheck -check-prefix=GG0 %s
+// RUN: %clang -### -c -g2 %s 2>&1 | FileCheck -check-prefix=G %s
+// RUN: %clang -### -c -g3 %s 2>&1 | FileCheck -check-prefix=G %s
+// RUN: %clang -### -c -ggdb %s 2>&1 | FileCheck -check-prefix=G %s
+// RUN: %clang -### -c -ggdb1 %s 2>&1 | FileCheck -check-prefix=G %s
+// RUN: %clang -### -c -ggdb3 %s 2>&1 | FileCheck -check-prefix=G %s
+// RUN: %clang -### -c -gdwarf-2 %s 2>&1 | FileCheck -check-prefix=G %s
+//
+// RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_NO %s
+// RUN: %clang -### -c -g -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
+// RUN: %clang -### -c -ggdb0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
+//
// RUN: %clang -### -c -gline-tables-only %s 2>&1 \
-// RUN: | FileCheck -check-prefix=GLTO %s
+// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
// RUN: %clang -### -c -gline-tables-only -g %s 2>&1 \
-// RUN: | FileCheck -check-prefix=GLTO2 %s
+// RUN: | FileCheck -check-prefix=G_ONLY %s
// RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \
-// RUN: | FileCheck -check-prefix=GLTO3 %s
+// RUN: | FileCheck -check-prefix=GLTO_NO %s
+//
+// RUN: %clang -c -grecord-gcc-switches -gno-record-gcc-switches \
+// RUN: -gstrict-dwarf -gno-strict-dwarf %s 2>&1 \
+// RUN: | not grep "argument unused during compilation"
//
// G: "-cc1"
// G: "-g"
//
-// G2: "-cc1"
-// G2: "-g"
-//
-// G3: "-cc1"
-// G3: "-g"
-//
-// GANY: "-cc1"
-// GANY-NOT: "-g"
-//
-// GGDB: "-cc1"
-// GGDB: "-g"
-//
-// GFOO: "-cc1"
-// GFOO-NOT: "-g"
-//
-// GG0: "-cc1"
-// GG0-NOT: "-g"
+// G_NO: "-cc1"
+// G_NO-NOT: "-g"
//
-// GLTO: "-cc1"
-// GLTO-NOT: "-g"
-// GLTO: "-gline-tables-only"
-// GLTO-NOT: "-g"
+// GLTO_ONLY: "-cc1"
+// GLTO_ONLY-NOT: "-g"
+// GLTO_ONLY: "-gline-tables-only"
+// GLTO_ONLY-NOT: "-g"
//
-// GLTO2: "-cc1"
-// GLTO2-NOT: "-gline-tables-only"
-// GLTO2: "-g"
-// GLTO2-NOT: "-gline-tables-only"
+// G_ONLY: "-cc1"
+// G_ONLY-NOT: "-gline-tables-only"
+// G_ONLY: "-g"
+// G_ONLY-NOT: "-gline-tables-only"
//
-// GLTO3: "-cc1"
-// GLTO3-NOT: "-gline-tables-only"
+// GLTO_NO: "-cc1"
+// GLTO_NO-NOT: "-gline-tables-only"
diff --git a/clang/test/Driver/debug-unsupported.c b/clang/test/Driver/debug-unsupported.c
new file mode 100644
index 00000000000..2c3de0b576f
--- /dev/null
+++ b/clang/test/Driver/debug-unsupported.c
@@ -0,0 +1,13 @@
+// RUN: %clang -c -gstabs %s 2>&1 | FileCheck %s
+// RUN: %clang -c -gstabs+ %s 2>&1 | FileCheck %s
+// RUN: %clang -c -gcoff %s 2>&1 | FileCheck %s
+// RUN: %clang -c -gxcoff %s 2>&1 | FileCheck %s
+// RUN: %clang -c -gxcoff+ %s 2>&1 | FileCheck %s
+// RUN: %clang -c -gvms %s 2>&1 | FileCheck %s
+// RUN: %clang -c -gstabs1 %s 2>&1 | FileCheck %s
+// RUN: %clang -c -gcoff2 %s 2>&1 | FileCheck %s
+// RUN: %clang -c -gxcoff3 %s 2>&1 | FileCheck %s
+// RUN: %clang -c -gvms0 %s 2>&1 | FileCheck %s
+// RUN: %clang -c -gtoggle %s 2>&1 | FileCheck %s
+//
+// CHECK: clang: error: unsupported option
OpenPOWER on IntegriCloud