[llvm-commits] [llvm] r66571 - in /llvm/trunk: include/llvm/CodeGen/DwarfWriter.h lib/CodeGen/AsmPrinter/DwarfWriter.cpp

Chris Lattner clattner at apple.com
Tue Mar 10 15:37:40 PDT 2009


On Mar 10, 2009, at 3:35 PM, Bill Wendling wrote:

> On Tue, Mar 10, 2009 at 2:29 PM, Chris Lattner <clattner at apple.com>  
> wrote:
>>
>> On Mar 10, 2009, at 1:41 PM, Bill Wendling wrote:
>>
>>> Author: void
>>> Date: Tue Mar 10 15:41:52 2009
>>> New Revision: 66571
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=66571&view=rev
>>> Log:
>>> Add a timer to the DwarfWriter pass that measures the total time it
>>> takes to
>>> emit exception and debug Dwarf info.
>>
>> Cool
>>> +
>>> +static TimerGroup *DwarfTimerGroup = 0;
>>> +static TimerGroup *getDwarfTimerGroup() {
>>> +  if (DwarfTimerGroup) return DwarfTimerGroup;
>>> +  return DwarfTimerGroup = new TimerGroup("Dwarf Exception and
>>> Debugging");
>>> +}
>>
>> How is this freed?
>>
> In the ~DwarfWriter() method.

Weird and subtle.  Would it make sense to just make it a static in the  
function?


static TimerGroup &getDwarfTimerGroup() {
   static TimerGroup DwarfTimerGroup("Dwarf Exception and Debugging");
   return DwarfTimerGroup;
}

?

-Chris



More information about the llvm-commits mailing list