r204517 - CGDebugInfo: At the end of EmitFunctionStart, Initialize PrevLoc to the

Adrian Prantl aprantl at apple.com
Tue Apr 1 16:28:25 PDT 2014


Still works on the original testcase. Thanks!

-- adrian

On Apr 1, 2014, at 3:32 PM, Eric Christopher <echristo at gmail.com> wrote:

> Hi Adrian,
> 
> I've just committed a fix in r205368 that redoes this a different way.
> We don't want to create a lexical scope, we just want to get the right
> source location for the code that we're emitting. After some chatting
> with Richard I've gone ahead and done what's in that PR. It should
> clean up the debug info and make sure that the line table is still
> correct.
> 
> Thanks!
> 
> -eric
> 
> On Fri, Mar 21, 2014 at 3:56 PM, Adrian Prantl <aprantl at apple.com> wrote:
>> All right. My fault for using a mangled name here!
>> 
>> thanks!
>> -- adrian
>> 
>> On Mar 21, 2014, at 3:55 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
>> 
>>> On Fri, Mar 21, 2014 at 5:01 PM, Adrian Prantl <aprantl at apple.com> wrote:
>>>> Author: adrian
>>>> Date: Fri Mar 21 16:01:58 2014
>>>> New Revision: 204517
>>>> 
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=204517&view=rev
>>>> Log:
>>>> CGDebugInfo: At the end of EmitFunctionStart, Initialize PrevLoc to the
>>>> location that the next call emitLocation() would default to. Otherwise
>>>> setLocation() may wrongly believe that the current source file didn't
>>>> change, when in fact it did.
>>>> 
>>>> Added:
>>>>   cfe/trunk/test/CodeGenCXX/linetable-fnbegin.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=204517&r1=204516&r2=204517&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>>>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Mar 21 16:01:58 2014
>>>> @@ -2577,9 +2577,12 @@ void CGDebugInfo::EmitFunctionStart(Glob
>>>>  if (HasDecl)
>>>>    DeclCache.insert(std::make_pair(D->getCanonicalDecl(), llvm::WeakVH(SP)));
>>>> 
>>>> -  // Push function on region stack.
>>>> +  // Push the function onto the lexical block stack.
>>>>  llvm::MDNode *SPN = SP;
>>>>  LexicalBlockStack.push_back(SPN);
>>>> +  // Initialize PrevLoc to the location of the function header.
>>>> +  PrevLoc = Loc;
>>>> +
>>>>  if (HasDecl)
>>>>    RegionMap[D] = llvm::WeakVH(SP);
>>>> }
>>>> 
>>>> Added: cfe/trunk/test/CodeGenCXX/linetable-fnbegin.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/linetable-fnbegin.cpp?rev=204517&view=auto
>>>> ==============================================================================
>>>> --- cfe/trunk/test/CodeGenCXX/linetable-fnbegin.cpp (added)
>>>> +++ cfe/trunk/test/CodeGenCXX/linetable-fnbegin.cpp Fri Mar 21 16:01:58 2014
>>>> @@ -0,0 +1,24 @@
>>>> +// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
>>>> +// Test that the line table info for Foo<T>::bar() is pointing to the
>>>> +// right header file.
>>>> +// CHECK: define{{.*}} @_ZN3FooIiE3barEv
>>>> +// CHECK-NOT: define
>>>> +// CHECK: ret {{.*}}, !dbg ![[DBG:.*]]
>>>> +// CHECK: ![[HPP:.*]] = metadata !{metadata !"./template.hpp",
>>>> +// CHECK:![[BLOCK:.*]] = metadata !{{{.*}}, metadata ![[HPP]], {{.*}}} ; [ DW_TAG_lexical_block ]
>>>> +// CHECK: [[DBG]] = metadata !{i32 23, i32 0, metadata ![[BLOCK]], null}
>>>> +# 1 "./template.h" 1
>>>> +template <typename T>
>>>> +class Foo {
>>>> +public:
>>>> + int bar();
>>>> +};
>>>> +# 21 "./template.hpp"
>>>> +template <typename T>
>>>> +int Foo<T>::bar() {
>>>> +}
>>>> +int main (int argc, const char * argv[])
>>>> +{
>>>> +  Foo<int> f;
>>>> +  f.bar();
>>>> +}
>>> 
>>> This testcase is causing one of the Windows bots to go red:
>>> 
>>> http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/1115
>>> 
>>> ~Aaron
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list