From 42d71b990677afc974c404fb0482cb5af176c3d0 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Thu, 10 Apr 2014 23:21:53 +0000 Subject: Debug info: (Bugfix) Make sure artificial functions like _GLOBAL__I_a are not associated with any source lines. Previously, if the Location of a Decl was empty, EmitFunctionStart would just keep using CurLoc, which would sometimes be correct (e.g., thunks) but in other cases would just point to a hilariously random location. This patch fixes this by completely eliminating all uses of CurLoc from EmitFunctionStart and rather have clients explicitly pass in a SourceLocation for the function header and the function body. rdar://problem/14985269 llvm-svn: 205999 --- clang/test/CodeGenCXX/globalinit-loc.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 clang/test/CodeGenCXX/globalinit-loc.cpp (limited to 'clang/test/CodeGenCXX/globalinit-loc.cpp') diff --git a/clang/test/CodeGenCXX/globalinit-loc.cpp b/clang/test/CodeGenCXX/globalinit-loc.cpp new file mode 100644 index 00000000000..bf3340c1572 --- /dev/null +++ b/clang/test/CodeGenCXX/globalinit-loc.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s +// rdar://problem/14985269. +// +// Verify that the global init helper function does not get associated +// with any source location. +// +// CHECK: define internal void @_GLOBAL__I_a +// CHECK-NOT: !dbg +// CHECK: "_GLOBAL__I_a", i32 0, {{.*}}, i32 0} ; [ DW_TAG_subprogram ] [line 0] [local] [def] +# 99 "someheader.h" +class A { +public: + A(); + int foo() { return 0; } +}; +# 5 "main.cpp" +A a; + +int f() { + return a.foo(); +} + -- cgit v1.2.3