[cfe-commits] r158906 - in /cfe/trunk: include/clang/Driver/Options.td lib/Driver/Tools.cpp test/Driver/debug-options.c test/Driver/debug-unsupported.c

Alexey Samsonov samsonov at google.com
Thu Jun 21 06:33:12 PDT 2012


On Thu, Jun 21, 2012 at 2:08 PM, Chandler Carruth <chandlerc at google.com>wrote:

> FYI, I'm seeing failures now when using CMake:
>
> [2/2] Running Clang and LLVM regression tests
> FAILED: cd /home/chandlerc/src/llvm.git/ninja-build/tools/clang/test &&
> /usr/bin/python /home/chandlerc/src/llvm.git/utils/lit/lit.py --param
> build_config=. --param build_mode=Debug -sv
> /home/chandlerc/src/llvm.git/ninja-build/test
> /home/chandlerc/src/llvm.git/ninja-build/tools/clang/test
> lit.py: lit.cfg:175: note: using clang:
> '/home/chandlerc/src/llvm.git/ninja-build/bin/./clang'
> -- Testing: 11473 tests, 16 threads --
> Testing: 0 .. 10..
> FAIL: Clang :: Driver/debug-unsupported.c (2262 of 11473)
> ******************** TEST 'Clang :: Driver/debug-unsupported.c' FAILED
> ********************
> Script:
> --
> /home/chandlerc/src/llvm.git/ninja-build/bin/./clang  -c -gstabs
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> 2>&1 | FileCheck
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> /home/chandlerc/src/llvm.git/ninja-build/bin/./clang  -c -gstabs+
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> 2>&1 | FileCheck
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> /home/chandlerc/src/llvm.git/ninja-build/bin/./clang  -c -gcoff
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> 2>&1 | FileCheck
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> /home/chandlerc/src/llvm.git/ninja-build/bin/./clang  -c -gxcoff
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> 2>&1 | FileCheck
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> /home/chandlerc/src/llvm.git/ninja-build/bin/./clang  -c -gxcoff+
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> 2>&1 | FileCheck
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> /home/chandlerc/src/llvm.git/ninja-build/bin/./clang  -c -gvms
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> 2>&1 | FileCheck
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> /home/chandlerc/src/llvm.git/ninja-build/bin/./clang  -c -gstabs1
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> 2>&1 | FileCheck
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> /home/chandlerc/src/llvm.git/ninja-build/bin/./clang  -c -gcoff2
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> 2>&1 | FileCheck
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> /home/chandlerc/src/llvm.git/ninja-build/bin/./clang  -c -gxcoff3
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> 2>&1 | FileCheck
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> /home/chandlerc/src/llvm.git/ninja-build/bin/./clang  -c -gvms0
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> 2>&1 | FileCheck
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> /home/chandlerc/src/llvm.git/ninja-build/bin/./clang  -c -gtoggle
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> 2>&1 | FileCheck
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c
> --
> Exit Code: 1
> Command Output (stderr):
> --
> /home/chandlerc/src/llvm.git/tools/clang/test/Driver/debug-unsupported.c:13:11:
> error: expected string not found in input
> // CHECK: clang: error: unsupported option
>           ^
> <stdin>:1:1: note: scanning from here
> clang-3: error: unsupported option '-gstabs'
> ^
> --
>
>
> I think you can just make the check a bit less restrictive:
>
> CHECK: error: unsupported option
>

Ouch. Submitted as r158916.



>
> On Thu, Jun 21, 2012 at 1:54 AM, Chandler Carruth <chandlerc at google.com>wrote:
>
>> On Thu, Jun 21, 2012 at 1:30 AM, Alexey Samsonov <samsonov at google.com>wrote:
>>
>>>
>>>
>>> On Thu, Jun 21, 2012 at 12:27 PM, Chandler Carruth <chandlerc at google.com
>>> > wrote:
>>>
>>>> On Thu, Jun 21, 2012 at 1:22 AM, Alexey Samsonov <samsonov at google.com>wrote:
>>>>
>>>>> Author: samsonov
>>>>> Date: Thu Jun 21 03:22:39 2012
>>>>> New Revision: 158906
>>>>>
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=158906&view=rev
>>>>> Log:
>>>>> 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.
>>>>>
>>>>
>>>> Largely unrelated, but would you be up for adding a release note about
>>>> -gline-tables-only?
>>>>
>>>
>>> Sure, how do I do that?
>>>
>>
>> Just edit docs/ReleaseNotes.html, add something, commit. =] It doesn't
>> need to be perfect, we'll word smith and clean up right before the release.
>>
>>
>>>
>>>
>>>>
>>>>>
>>>>> Added:
>>>>>    cfe/trunk/test/Driver/debug-unsupported.c
>>>>> Modified:
>>>>>    cfe/trunk/include/clang/Driver/Options.td
>>>>>    cfe/trunk/lib/Driver/Tools.cpp
>>>>>    cfe/trunk/test/Driver/debug-options.c
>>>>>
>>>>> Modified: cfe/trunk/include/clang/Driver/Options.td
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=158906&r1=158905&r2=158906&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- cfe/trunk/include/clang/Driver/Options.td (original)
>>>>> +++ cfe/trunk/include/clang/Driver/Options.td Thu Jun 21 03:22:39 2012
>>>>> @@ -33,6 +33,7 @@
>>>>>  def f_Group               : OptionGroup<"<f group>">,
>>>>> Group<CompileOnly_Group>;
>>>>>  def f_clang_Group         : OptionGroup<"<f (clang-only) group>">,
>>>>> Group<CompileOnly_Group>;
>>>>>  def g_Group               : OptionGroup<"<g group>">;
>>>>> +def g_flags_Group         : OptionGroup<"<g flags group>">;
>>>>>  def i_Group               : OptionGroup<"<i group>">,
>>>>> Group<CompileOnly_Group>;
>>>>>  def clang_i_Group         : OptionGroup<"<clang i group>">,
>>>>> Group<i_Group>;
>>>>>  def m_Group               : OptionGroup<"<m group>">,
>>>>> Group<CompileOnly_Group>;
>>>>> @@ -671,21 +672,34 @@
>>>>>  def fdata_sections : Flag <"-fdata-sections">, Group<f_Group>,
>>>>> Flags<[CC1Option]>,
>>>>>   HelpText<"Place each data in its own section (ELF Only)">;
>>>>>  def f : Joined<"-f">, Group<f_Group>;
>>>>> +def g_Flag : Flag<"-g">, Group<g_Group>,
>>>>> +  HelpText<"Generate source level debug information">,
>>>>> Flags<[CC1Option]>;
>>>>> +def gline_tables_only : Flag<"-gline-tables-only">, Group<g_Group>,
>>>>> +  HelpText<"Emit debug line number tables only">, Flags<[CC1Option]>;
>>>>>  def g0 : Flag<"-g0">, Group<g_Group>;
>>>>> +def g1 : Flag<"-g1">, Group<g_Group>;
>>>>>  def g2 : Flag<"-g2">, Group<g_Group>;
>>>>>  def g3 : Flag<"-g3">, Group<g_Group>;
>>>>> -def gdwarf2 : Flag<"-gdwarf-2">, Group<g_Group>;
>>>>> -def gfull : Flag<"-gfull">, Group<g_Group>;
>>>>>  def ggdb : Flag<"-ggdb">, Group<g_Group>;
>>>>> -def gstabs : Flag<"-gstabs">, Group<g_Group>;
>>>>> -def gstabsplus : Flag<"-gstabs+">, Group<g_Group>;
>>>>> -def gstabs1 : Flag<"-gstabs1">, Group<g_Group>;
>>>>> -def gstabs2 : Flag<"-gstabs2">, Group<g_Group>;
>>>>> +def ggdb0 : Flag<"-ggdb0">, Group<g_Group>;
>>>>> +def ggdb1 : Flag<"-ggdb1">, Group<g_Group>;
>>>>> +def ggdb2 : Flag<"-ggdb2">, Group<g_Group>;
>>>>> +def ggdb3 : Flag<"-ggdb3">, Group<g_Group>;
>>>>> +def gdwarf_2 : Flag<"-gdwarf-2">, Group<g_Group>;
>>>>> +def gdwarf_3 : Flag<"-gdwarf-3">, Group<g_Group>;
>>>>> +def gdwarf_4 : Flag<"-gdwarf-4">, Group<g_Group>;
>>>>> +def gfull : Flag<"-gfull">, Group<g_Group>;
>>>>>  def gused : Flag<"-gused">, Group<g_Group>;
>>>>> -def g_Flag : Flag<"-g">, Group<g_Group>, HelpText<"Generate source
>>>>> level debug information">,
>>>>> -    Flags<[CC1Option]>;
>>>>> -def gline_tables_only : Flag<"-gline-tables-only">, Group<g_Group>,
>>>>> -  HelpText<"Emit debug line number tables only">, Flags<[CC1Option]>;
>>>>> +def gstabs : Joined<"-gstabs">, Group<g_Group>, Flags<[Unsupported]>;
>>>>> +def gcoff : Joined<"-gcoff">, Group<g_Group>, Flags<[Unsupported]>;
>>>>> +def gxcoff : Joined<"-gxcoff">, Group<g_Group>, Flags<[Unsupported]>;
>>>>> +def gvms : Joined<"-gvms">, Group<g_Group>, Flags<[Unsupported]>;
>>>>> +def gtoggle : Flag<"-gtoggle">, Group<g_flags_Group>,
>>>>> Flags<[Unsupported]>;
>>>>> +def grecord_gcc_switches : Flag<"-grecord-gcc-switches">,
>>>>> Group<g_flags_Group>;
>>>>> +def gno_record_gcc_switches : Flag<"-gno-record-gcc-switches">,
>>>>> +  Group<g_flags_Group>;
>>>>> +def gstrict_dwarf : Flag<"-gstrict-dwarf">, Group<g_flags_Group>;
>>>>> +def gno_strict_dwarf : Flag<"-gno-strict-dwarf">,
>>>>> Group<g_flags_Group>;
>>>>>  def headerpad__max__install__names :
>>>>> Joined<"-headerpad_max_install_names">;
>>>>>  def help : Flag<"-help">, Flags<[CC1Option]>,
>>>>>   HelpText<"Display available options">;
>>>>>
>>>>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=158906&r1=158905&r2=158906&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>>>>> +++ cfe/trunk/lib/Driver/Tools.cpp Thu Jun 21 03:22:39 2012
>>>>> @@ -1910,21 +1910,19 @@
>>>>>
>>>>>   // Use the last option from "-g" group. "-gline-tables-only" is
>>>>>   // preserved, all other debug options are substituted with "-g".
>>>>> -  // FIXME: We should eventually do the following:
>>>>> -  //   1) collapse gdb and dwarf variations to -g (as we do now);
>>>>> -  //   2) support things like -gtoggle;
>>>>> -  //   3) ignore flag options like -gstrict-dwarf or
>>>>> -grecord-gcc-switches;
>>>>> -  //   4) produce a driver error on unsupported formats
>>>>> -  //      (-gstabs, -gcoff, -gvms etc.)
>>>>>   Args.ClaimAllArgs(options::OPT_g_Group);
>>>>>   if (Arg *A = Args.getLastArg(options::OPT_g_Group)) {
>>>>>     if (A->getOption().matches(options::OPT_gline_tables_only)) {
>>>>>       CmdArgs.push_back("-gline-tables-only");
>>>>> -    } else if (!A->getOption().matches(options::OPT_g0)) {
>>>>> +    } else if (!A->getOption().matches(options::OPT_g0) &&
>>>>> +               !A->getOption().matches(options::OPT_ggdb0)) {
>>>>>       CmdArgs.push_back("-g");
>>>>>     }
>>>>>   }
>>>>>
>>>>> +  // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
>>>>> +  Args.ClaimAllArgs(options::OPT_g_flags_Group);
>>>>> +
>>>>>   Args.AddAllArgs(CmdArgs, options::OPT_ffunction_sections);
>>>>>   Args.AddAllArgs(CmdArgs, options::OPT_fdata_sections);
>>>>>
>>>>>
>>>>> Modified: cfe/trunk/test/Driver/debug-options.c
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-options.c?rev=158906&r1=158905&r2=158906&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- cfe/trunk/test/Driver/debug-options.c (original)
>>>>> +++ cfe/trunk/test/Driver/debug-options.c Thu Jun 21 03:22:39 2012
>>>>> @@ -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"
>>>>> -//
>>>>> -// GLTO: "-cc1"
>>>>> -// GLTO-NOT: "-g"
>>>>> -// GLTO: "-gline-tables-only"
>>>>> -// GLTO-NOT: "-g"
>>>>> +// G_NO: "-cc1"
>>>>> +// G_NO-NOT: "-g"
>>>>>  //
>>>>> -// GLTO2: "-cc1"
>>>>> -// GLTO2-NOT: "-gline-tables-only"
>>>>> -// GLTO2: "-g"
>>>>> -// GLTO2-NOT: "-gline-tables-only"
>>>>> +// GLTO_ONLY: "-cc1"
>>>>> +// GLTO_ONLY-NOT: "-g"
>>>>> +// GLTO_ONLY: "-gline-tables-only"
>>>>> +// GLTO_ONLY-NOT: "-g"
>>>>> +//
>>>>> +// 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"
>>>>>
>>>>> Added: cfe/trunk/test/Driver/debug-unsupported.c
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-unsupported.c?rev=158906&view=auto
>>>>>
>>>>> ==============================================================================
>>>>> --- cfe/trunk/test/Driver/debug-unsupported.c (added)
>>>>> +++ cfe/trunk/test/Driver/debug-unsupported.c Thu Jun 21 03:22:39 2012
>>>>> @@ -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
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> cfe-commits mailing list
>>>>> cfe-commits at cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Alexey Samsonov, MSK
>>>
>>>
>>
>


-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120621/5a25c4aa/attachment.html>


More information about the cfe-commits mailing list