r311601 - Fix a bug in CGDebugInfo::EmitInlineFunctionStart causing DILocations to be

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 28 16:47:09 PDT 2017


*nod* Thanks - let me know if you have trouble simplifying or explaining it
& I'll see if fresh eyes help :)

On Mon, Aug 28, 2017 at 4:46 PM Adrian Prantl <aprantl at apple.com> wrote:

> It's possible that this testcase can be golfed some more. I copied it
> almost verbatim from the PR. I'll see what I can do. The important thing is
> that it needs to trigger the situation where the frontend is creating an
> inlined function.
>
> -- adrian
>
> On Aug 28, 2017, at 4:43 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
> Seems like a rather complex test case - could you explain what's going on
> there? (maybe in the form of a comment in the code - what path through all
> those classes is required to tickle this)
>
> On Wed, Aug 23, 2017 at 2:25 PM Adrian Prantl via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Author: adrian
>> Date: Wed Aug 23 14:24:12 2017
>> New Revision: 311601
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=311601&view=rev
>> Log:
>> Fix a bug in CGDebugInfo::EmitInlineFunctionStart causing DILocations to
>> be
>> parented in function declarations.
>>
>> Fixes PR33997.
>> https://bugs.llvm.org/show_bug.cgi?id=33997
>>
>> Added:
>>     cfe/trunk/test/CodeGenCXX/debug-info-inlined.cpp
>> 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=311601&r1=311600&r2=311601&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Aug 23 14:24:12 2017
>> @@ -3287,7 +3287,7 @@ void CGDebugInfo::EmitInlineFunctionStar
>>    llvm::DISubprogram *SP = nullptr;
>>    if (FI != SPCache.end())
>>      SP = dyn_cast_or_null<llvm::DISubprogram>(FI->second);
>> -  if (!SP)
>> +  if (!SP || !SP->isDefinition())
>>      SP = getFunctionStub(GD);
>>    FnBeginRegionCount.push_back(LexicalBlockStack.size());
>>    LexicalBlockStack.emplace_back(SP);
>>
>> Added: cfe/trunk/test/CodeGenCXX/debug-info-inlined.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-inlined.cpp?rev=311601&view=auto
>>
>> ==============================================================================
>> --- cfe/trunk/test/CodeGenCXX/debug-info-inlined.cpp (added)
>> +++ cfe/trunk/test/CodeGenCXX/debug-info-inlined.cpp Wed Aug 23 14:24:12
>> 2017
>> @@ -0,0 +1,45 @@
>> +// RUN: %clang_cc1 -emit-llvm -triple i686-pc-windows-msvc19.0.24213
>> -gcodeview -debug-info-kind=limited -std=c++14 %s -o - | FileCheck %s
>> +// PR33997.
>> +struct already_AddRefed {
>> +  ~already_AddRefed();
>> +};
>> +struct RefPtr {
>> +  operator int *();
>> +};
>> +struct ServoCssRulesStrong {
>> +  already_AddRefed Consume();
>> +};
>> +struct GroupRule {
>> +  GroupRule(already_AddRefed);
>> +};
>> +class ConditionRule : GroupRule {
>> +  using GroupRule::GroupRule;
>> +};
>> +class CSSMediaRule : ConditionRule {
>> +  using ConditionRule::ConditionRule;
>> +};
>> +class CSSMozDocumentRule : ConditionRule {
>> +  using ConditionRule::ConditionRule;
>> +};
>> +class ServoDocumentRule : CSSMozDocumentRule {
>> +  ServoDocumentRule(RefPtr);
>> +};
>> +class ServoMediaRule : CSSMediaRule {
>> +  ServoMediaRule(RefPtr);
>> +};
>> +ServoCssRulesStrong Servo_MediaRule_GetRules(int *);
>> +ServoCssRulesStrong Servo_DocumentRule_GetRules(int *);
>> +ServoDocumentRule::ServoDocumentRule(RefPtr aRawRule)
>> +    :
>> CSSMozDocumentRule(Servo_DocumentRule_GetRules(aRawRule).Consume()) {}
>> +
>> +ServoMediaRule::ServoMediaRule(RefPtr aRawRule)
>> +    : CSSMediaRule(Servo_MediaRule_GetRules(aRawRule).Consume()) {}
>> +
>> +// CHECK: define{{.*}}ServoMediaRule
>> +// CHECK-NOT: {{ ret }}
>> +// CHECK: store %class.ConditionRule* %
>> +// CHECK-SAME: %class.ConditionRule** %
>> +// CHECK-SAME: !dbg ![[INL:[0-9]+]]
>> +
>> +// CHECK: ![[INL]] = !DILocation(line: 16, scope: ![[SP:[0-9]+]],
>> inlinedAt:
>> +// CHECK: ![[SP]] = distinct !DISubprogram(name: "GroupRule",
>> {{.*}}isDefinition: true
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170828/7423ce40/attachment.html>


More information about the cfe-commits mailing list