blob: 6d722c2985252cc5d188c024c1d5283ff166fc71 [file] [log] [blame]
Diego Novillo795f53b2014-10-22 13:00:05 +00001// This file tests that -fprofile-sample-use enables location tracking
2// generation in the same way that -Rpass does. The sample profiler needs
3// to associate line locations in the profile to the code, so it needs the
4// frontend to emit source location annotations.
5
6// RUN: %clang_cc1 %s -fprofile-sample-use=%S/Inputs/profile-sample-use-loc-tracking.prof -emit-llvm -o - 2>/dev/null | FileCheck %s
7
8// -fprofile-sample-use should produce source location annotations, exclusively
9// (just like -gmlt).
10// CHECK: , !dbg !
11// CHECK-NOT: DW_TAG_base_type
12
Adrian Prantl826824e2016-04-08 22:43:06 +000013// The CU should be marked NoDebug (to prevent writing debug info to
Diego Novillo795f53b2014-10-22 13:00:05 +000014// the final output).
Adrian Prantl826824e2016-04-08 22:43:06 +000015// CHECK: !llvm.dbg.cu = !{![[CU:.*]]}
16// CHECK: ![[CU]] = distinct !DICompileUnit({{.*}}emissionKind: NoDebug
Diego Novillo795f53b2014-10-22 13:00:05 +000017
18int bar(int j) {
19 return (j + j - 2) * (j - 2) * j;
20}