]> granicus.if.org Git - clang/commitdiff
Debug info: Apply an artificial debug location to __cyg_profile_func.* calls.
authorAdrian Prantl <aprantl@apple.com>
Thu, 28 Apr 2016 17:21:56 +0000 (17:21 +0000)
committerAdrian Prantl <aprantl@apple.com>
Thu, 28 Apr 2016 17:21:56 +0000 (17:21 +0000)
The LLVM Verifier expects all inlinable calls in debuggable functions to
have a location.

rdar://problem/25818489

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267904 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenFunction.cpp
test/CodeGen/instrument-functions.c

index 29a513f2bdfc335f6ae7453be0a422364f7d5d1d..0ed425ba46a23184e5d1e2ba9874044f11179b33 100644 (file)
@@ -401,6 +401,7 @@ bool CodeGenFunction::ShouldInstrumentFunction() {
 /// instrumentation function with the current function and the call site, if
 /// function instrumentation is enabled.
 void CodeGenFunction::EmitFunctionInstrumentation(const char *Fn) {
+  auto NL = ApplyDebugLocation::CreateArtificial(*this);
   // void __cyg_profile_func_{enter,exit} (void *this_fn, void *call_site);
   llvm::PointerType *PointerTy = Int8PtrTy;
   llvm::Type *ProfileFuncArgs[] = { PointerTy, PointerTy };
index d80385e2239abced40d6669d4011b5468ba1a3f7..454dc4de5220db0b92b49d64173f57758f151cb0 100644 (file)
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -S -emit-llvm -o - %s -finstrument-functions | FileCheck %s
+// RUN: %clang_cc1 -S -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-functions | FileCheck %s
 
 // CHECK: @test1
 int test1(int x) {
-// CHECK: __cyg_profile_func_enter
-// CHECK: __cyg_profile_func_exit
+// CHECK: call void @__cyg_profile_func_enter({{.*}}, !dbg
+// CHECK: call void @__cyg_profile_func_exit({{.*}}, !dbg
 // CHECK: ret
   return x;
 }