[llvm] r188708 - Turn on pubnames by default on linux.
Eric Christopher
echristo at gmail.com
Mon Aug 19 14:45:29 PDT 2013
>
> Interestingly inconsistent in the assignment between the 'if' (using a
> nested if) and the 'else' (using the conditional operator)
>
> Though, being the terse individual that I am, I'd probably write this as:
>
> if (DwarfPubNames == Default)
> HasDwarfPubNames = !IsDarwin;
> else
> HasDwarfPubNames = DwarfPubNames == Enable;
>
More pithy works for me. Fixed it up for the other cases as well.
>
> Wrapping it into a single conditional might be a bit much:
>
> HasDwarfPubNames = DwarfPubNames == Default ? !IsDarwin :
> DwarfPubNames == Enable;
>
> & you can leave it as written if you have a substantial preference
Not particularly. I like slightly more verbose so the single
conditional isn't fabulous, but the other suggestion looks great.
Thanks!
-eric
> (though I still find the inconsistency between the two blocks
> noteworthy, but the if/conditional/assign-from-bool choice of how you
> implement them is ultimately up to you)
>
>> +
>> DwarfVersion = getDwarfVersionFromModule(MMI->getModule());
>>
>> {
>> @@ -797,7 +808,7 @@ void DwarfDebug::constructSubprogramDIE(
>> TheCU->addToContextOwner(SubprogramDie, SP.getContext());
>>
>> // Expose as global, if requested.
>> - if (GenerateDwarfPubNamesSection)
>> + if (HasDwarfPubNames)
>> TheCU->addGlobalName(SP.getName(), SubprogramDie);
>> }
>>
>> @@ -1146,7 +1157,7 @@ void DwarfDebug::endModule() {
>> }
>>
>> // Emit info into a debug pubnames section, if requested.
>> - if (GenerateDwarfPubNamesSection)
>> + if (HasDwarfPubNames)
>> emitDebugPubnames();
>>
>> // Emit info into a debug pubtypes section.
>> @@ -1932,7 +1943,7 @@ void DwarfDebug::emitSectionLabels() {
>> DwarfLineSectionSym =
>> emitSectionSym(Asm, TLOF.getDwarfLineSection(), "section_line");
>> emitSectionSym(Asm, TLOF.getDwarfLocSection());
>> - if (GenerateDwarfPubNamesSection)
>> + if (HasDwarfPubNames)
>> emitSectionSym(Asm, TLOF.getDwarfPubNamesSection());
>> emitSectionSym(Asm, TLOF.getDwarfPubTypesSection());
>> DwarfStrSectionSym =
>> @@ -2307,8 +2318,8 @@ void DwarfDebug::emitDebugPubnames() {
>> continue;
>>
>> // Start the dwarf pubnames section.
>> - Asm->OutStreamer.SwitchSection(
>> - Asm->getObjFileLowering().getDwarfPubNamesSection());
>> + Asm->OutStreamer
>> + .SwitchSection(Asm->getObjFileLowering().getDwarfPubNamesSection());
>>
>> Asm->OutStreamer.AddComment("Length of Public Names Info");
>> Asm->EmitLabelDifference(Asm->GetTempSymbol("pubnames_end", ID),
>>
>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=188708&r1=188707&r2=188708&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Mon Aug 19 16:07:38 2013
>> @@ -434,6 +434,7 @@ class DwarfDebug {
>> // DWARF5 Experimental Options
>> bool HasDwarfAccelTables;
>> bool HasSplitDwarf;
>> + bool HasDwarfPubNames;
>>
>> unsigned DwarfVersion;
>>
>>
>> Copied: llvm/trunk/test/DebugInfo/X86/dwarf-public-names.ll (from r188699, llvm/trunk/test/DebugInfo/dwarf-public-names.ll)
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dwarf-public-names.ll?p2=llvm/trunk/test/DebugInfo/X86/dwarf-public-names.ll&p1=llvm/trunk/test/DebugInfo/dwarf-public-names.ll&r1=188699&r2=188708&rev=188708&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/DebugInfo/dwarf-public-names.ll (original)
>> +++ llvm/trunk/test/DebugInfo/X86/dwarf-public-names.ll Mon Aug 19 16:07:38 2013
>> @@ -1,7 +1,7 @@
>> -; REQUIRES: object-emission
>> -
>> -; RUN: llc -generate-dwarf-pubnames -filetype=obj -o %t.o < %s
>> -; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck %s
>> +; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t.o < %s
>> +; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck --check-prefix=LINUX %s
>> +; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -o %t.o < %s
>> +; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck --check-prefix=DARWIN %s
>> ; ModuleID = 'dwarf-public-names.cpp'
>> ;
>> ; Generated from:
>> @@ -35,16 +35,20 @@
>> ; int global_namespace_variable = 1;
>> ; }
>>
>> +; Darwin shouldn't be generating the section by default
>> +; DARWIN: debug_pubnames
>> +; DARWIN: Size: 0
>> +
>> ; Skip the output to the header of the pubnames section.
>> -; CHECK: debug_pubnames
>> +; LINUX: debug_pubnames
>>
>> ; Check for each name in the output.
>> -; CHECK: global_namespace_variable
>> -; CHECK: global_namespace_function
>> -; CHECK: static_member_function
>> -; CHECK: global_variable
>> -; CHECK: global_function
>> -; CHECK: member_function
>> +; LINUX: global_namespace_variable
>> +; LINUX: global_namespace_function
>> +; LINUX: static_member_function
>> +; LINUX: global_variable
>> +; LINUX: global_function
>> +; LINUX: member_function
>>
>> %struct.C = type { i8 }
>>
>>
>> Modified: llvm/trunk/test/DebugInfo/dwarf-public-names.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarf-public-names.ll?rev=188708&r1=188707&r2=188708&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/DebugInfo/dwarf-public-names.ll (original)
>> +++ llvm/trunk/test/DebugInfo/dwarf-public-names.ll Mon Aug 19 16:07:38 2013
>> @@ -1,6 +1,6 @@
>> ; REQUIRES: object-emission
>>
>> -; RUN: llc -generate-dwarf-pubnames -filetype=obj -o %t.o < %s
>> +; RUN: llc -generate-dwarf-pubnames=Enable -filetype=obj -o %t.o < %s
>> ; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck %s
>> ; ModuleID = 'dwarf-public-names.cpp'
>> ;
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list