r185483 - Debug Info: set default to gdwarf-2 for Darwin.
Manman Ren
mren at apple.com
Wed Jul 3 11:17:28 PDT 2013
Thanks Chad, I will update the testing case.
Manman
On Jul 3, 2013, at 9:55 AM, Chad Rosier <mcrosier at apple.com> wrote:
> Manman,
> Inline comments below.
>
> On Jul 2, 2013, at 4:15 PM, Manman Ren <mren at apple.com> wrote:
>
>> Author: mren
>> Date: Tue Jul 2 18:15:25 2013
>> New Revision: 185483
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=185483&view=rev
>> Log:
>> Debug Info: set default to gdwarf-2 for Darwin.
>>
>> Darwin systems currently do not support dwarf version 3 or above. When we are
>> ready, we can bump the default to gdwarf-4 for Darwin.
>>
>> For other systems, the default is dwarf version 3, if everything goes smoothly,
>> we can bump the version to 4.
>>
>> rdar://13591116
>>
>> Modified:
>> cfe/trunk/lib/Driver/Tools.cpp
>> cfe/trunk/test/CodeGen/dwarf-version.c
>> cfe/trunk/test/Driver/clang-g-opts.c
>> cfe/trunk/test/Driver/debug-options.c
>>
>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=185483&r1=185482&r2=185483&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>> +++ cfe/trunk/lib/Driver/Tools.cpp Tue Jul 2 18:15:25 2013
>> @@ -2521,8 +2521,13 @@ void Clang::ConstructJob(Compilation &C,
>> else if (A->getOption().matches(options::OPT_gdwarf_4))
>> CmdArgs.push_back("-gdwarf-4");
>> else if (!A->getOption().matches(options::OPT_g0) &&
>> - !A->getOption().matches(options::OPT_ggdb0))
>> - CmdArgs.push_back("-g");
>> + !A->getOption().matches(options::OPT_ggdb0)) {
>> + // Default is dwarf-2 for darwin.
>> + if (getToolChain().getTriple().isOSDarwin())
>> + CmdArgs.push_back("-gdwarf-2");
>> + else
>> + CmdArgs.push_back("-g");
>> + }
>> }
>>
>> // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
>>
>> Modified: cfe/trunk/test/CodeGen/dwarf-version.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/dwarf-version.c?rev=185483&r1=185482&r2=185483&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/CodeGen/dwarf-version.c (original)
>> +++ cfe/trunk/test/CodeGen/dwarf-version.c Tue Jul 2 18:15:25 2013
>> @@ -1,6 +1,8 @@
>> // RUN: %clang -target x86_64-linux-gnu -gdwarf-2 -S -emit-llvm -o - %s | FileCheck %s
>> // RUN: %clang -target x86_64-linux-gnu -gdwarf-3 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER3
>> // RUN: %clang -target x86_64-linux-gnu -gdwarf-4 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4
>> +// RUN: %clang -target x86_64-linux-gnu -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=LINUX
>> +// RUN: %clang -target x86_64-apple-darwin -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=DARWIN
>> int main (void) {
>> return 0;
>> }
>> @@ -8,3 +10,5 @@ int main (void) {
>> // CHECK: metadata !{i32 2, metadata !"Dwarf Version", i32 2}
>> // VER3: metadata !{i32 2, metadata !"Dwarf Version", i32 3}
>> // VER4: metadata !{i32 2, metadata !"Dwarf Version", i32 4}
>> +// LINUX: metadata !{i32 2, metadata !"Dwarf Version", i32 3}
>> +// DARWIN: metadata !{i32 2, metadata !"Dwarf Version", i32 2}
>>
>> Modified: cfe/trunk/test/Driver/clang-g-opts.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-g-opts.c?rev=185483&r1=185482&r2=185483&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/Driver/clang-g-opts.c (original)
>> +++ cfe/trunk/test/Driver/clang-g-opts.c Tue Jul 2 18:15:25 2013
>> @@ -5,5 +5,6 @@
>> // RUN: %clang -### -S %s -g0 -g 2>&1 | FileCheck --check-prefix=CHECK-WITH-G %s
>>
>> // CHECK-WITHOUT-G-NOT: "-g"
>> -// CHECK-WITH-G: "-g"
>> +// Can be -gdwarf.
>> +// CHECK-WITH-G: "-g
>
> You should be able to better express this with a regular expression. Something like {{"-g"|"-gdwarf"}}. You'll need to verify the RE syntax yourself.
>
> Alternatively, (and perhaps the better choice) you could have two checks, one for Darwin and the other for non-Darwin.
>
>>
>> Modified: cfe/trunk/test/Driver/debug-options.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-options.c?rev=185483&r1=185482&r2=185483&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/Driver/debug-options.c (original)
>> +++ cfe/trunk/test/Driver/debug-options.c Tue Jul 2 18:15:25 2013
>> @@ -26,7 +26,8 @@
>> // RUN: | FileCheck -check-prefix=GIGNORE %s
>> //
>> // G: "-cc1"
>> -// G: "-g"
>> +// Can be -gdwarf.
>> +// G: "-g
>
> Ditto.
>
>> //
>> // G_D2: "-cc1"
>> // G_D2: "-gdwarf-2"
>> @@ -41,7 +42,7 @@
>> //
>> // G_ONLY: "-cc1"
>> // G_ONLY-NOT: "-gline-tables-only"
>> -// G_ONLY: "-g"
>> +// G_ONLY: "-g
>
> Again.
>
>> // G_ONLY-NOT: "-gline-tables-only"
>> //
>> // GLTO_NO: "-cc1"
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130703/213f7931/attachment.html>
More information about the cfe-commits
mailing list