[cfe-commits] r112833 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Devang Patel dpatel at apple.com
Thu Sep 2 10:49:48 PDT 2010


On Sep 2, 2010, at 10:45 AM, David Chisnall wrote:

> On 2 Sep 2010, at 18:31, Devang Patel wrote:
> 
>> 
>> On Sep 2, 2010, at 10:16 AM, David Chisnall wrote:
>> 
>>> Author: theraven
>>> Date: Thu Sep  2 12:16:32 2010
>>> New Revision: 112833
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=112833&view=rev
>>> Log:
>>> Use the unmangled name for the display name in Objective-C debug info.  This should have no effect with the Mac runtime where clang (unlike GCC) uses the display name symbol name.
>>> 
>> 
>> test case ?
> 
> I'm not sure what the test case would test.

The patch would change something in generated LLVM IR.
> 
>>> Modified:
>>>  cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>> 
>>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=112833&r1=112832&r2=112833&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Sep  2 12:16:32 2010
>>> @@ -1471,6 +1471,20 @@
>>>   Name = getFunctionName(FD);
>>>   // Use mangled name as linkage name for c/c++ functions.
>>>   LinkageName = CGM.getMangledName(GD);
>>> +  } else if (const ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(D)) {
>>> +    llvm::SmallString<256> MethodName;
>>> +    llvm::raw_svector_ostream OS(MethodName);
>>> +    OS << (OMD->isInstanceMethod() ? '-' : '+') << '[';
>>> +    const DeclContext *DC = OMD->getDeclContext();
>>> +    if (const ObjCImplementationDecl *OID = dyn_cast<const ObjCImplementationDecl>(DC)) {
>>> +       OS << OID->getName();
>>> +    } else if (const ObjCCategoryImplDecl *OCD = dyn_cast<const ObjCCategoryImplDecl>(DC)){
>>> +        OS << ((NamedDecl *)OCD)->getIdentifier()->getNameStart() << '(' <<
>>> +            OCD->getIdentifier()->getNameStart() << ')';
>>> +    }
>>> +    OS << ' ' << OMD->getSelector().getAsString() << ']';
>>> +    Name = MethodName;
>> 
>> Isn't this means Name will reference local SmallString MethodName outside MethodName's scope ?
> 
> Could be.  I'm not entirely clear about how LLVM's string stuff works - I assumed it was a copy that was optimised away - if so moving the MethodName declaration outside the block should fix it.

See getFunctionName() implementation.

-
Devang

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100902/a35c9282/attachment.html>


More information about the cfe-commits mailing list