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

llvm-svn: 267904
This commit is contained in:
Adrian Prantl 2016-04-28 17:21:56 +00:00
parent 3afb266886
commit 06f445d65b
2 changed files with 4 additions and 3 deletions

View 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 };

View 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;
}