1// Test that the specified output has profiling data.
2// RUN: %clang_profgen -fcoverage-mapping -o %t %s
3// RUN: %run %t %t.file.profraw
4// RUN: test -f %t.file.profraw
5// RUN: llvm-profdata merge -o %t.file.profdata %t.file.profraw
6// RUN: llvm-cov show -instr-profile %t.file.profdata %t | FileCheck %s --match-full-lines
7// RUN: rm %t.file.profraw %t.file.profdata
8#include <stdio.h>
9
10extern void __llvm_profile_set_file_object(FILE *, int);
11
12int main(int argc, const char *argv[]) {
13 if (argc < 2)
14 return 1;
15
16 FILE *F = fopen(filename: argv[1], modes: "w+b");
17 __llvm_profile_set_file_object(F, 0);
18 return 0;
19}
20// CHECK: 8| |#include <stdio.h>
21// CHECK: 9| |
22// CHECK: 10| |extern void __llvm_profile_set_file_object(FILE *, int);
23// CHECK: 11| |
24// CHECK: 12| 1|int main(int argc, const char *argv[]) {
25// CHECK: 13| 1| if (argc < 2)
26// CHECK: 14| 0| return 1;
27// CHECK: 15| |
28// CHECK: 16| 1| FILE *F = fopen(argv[1], "w+b");
29// CHECK: 17| 1| __llvm_profile_set_file_object(F, 0);
30// CHECK: 18| 1| return 0;
31// CHECK: 19| 1|}
32

source code of compiler-rt/test/profile/instrprof-set-file-object.c