Should these have no/artificial location? It seems like perhaps they should
have the same location as the scope they're for? (well, the beginning or
end of that scope, respectively, etc)

On Thu, Apr 28, 2016 at 10:21 AM, Adrian Prantl via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: adrian
> Date: Thu Apr 28 12:21:56 2016
> New Revision: 267904
>
> URL: http://llvm.org/viewvc/llvm-project?rev=267904&view=rev
> Log:
> 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
>
> Modified:
>     cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
>     cfe/trunk/test/CodeGen/instrument-functions.c
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=267904&r1=267903&r2=267904&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Thu Apr 28 12:21:56 2016
> @@ -401,6 +401,7 @@ bool CodeGenFunction::ShouldInstrumentFu
>  /// 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 };
>
> Modified: cfe/trunk/test/CodeGen/instrument-functions.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/instrument-functions.c?rev=267904&r1=267903&r2=267904&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CodeGen/instrument-functions.c (original)
> +++ cfe/trunk/test/CodeGen/instrument-functions.c Thu Apr 28 12:21:56 2016
> @@ -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;
>  }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to