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);
}
--- /dev/null
+// 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();
+}