From: Adrian Prantl Date: Thu, 28 Apr 2016 17:21:56 +0000 (+0000) Subject: Debug info: Apply an artificial debug location to __cyg_profile_func.* calls. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c6bda0e76bfe08d52ae687be8f53160c6d82c27;p=clang Debug info: Apply an artificial debug location to __cyg_profile_func.* calls. 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 --- diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 29a513f2bd..0ed425ba46 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -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 }; diff --git a/test/CodeGen/instrument-functions.c b/test/CodeGen/instrument-functions.c index d80385e223..454dc4de52 100644 --- a/test/CodeGen/instrument-functions.c +++ b/test/CodeGen/instrument-functions.c @@ -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; }