llvm/clang/test/Driver/fcs-profile-generate.c
Fangrui Song cf45731f0e [Driver] Fix assertion failure when -fprofile-generate -fcs-profile-generate are used together
If conflicting `-fprofile-generate -fcs-profile-generate` are used together,
there is currently an assertion failure. Fix the failure.

Also add some driver tests.

Reviewed By: xur

Differential Revision: https://reviews.llvm.org/D94463
2021-01-12 14:19:55 -08:00

16 lines
955 B
C

// RUN: %clang -### -c -fprofile-use=a.profdata -fcs-profile-generate %s 2>&1 | FileCheck %s
// CHECK: "-fprofile-instrument=csllvm"
// CHECK-NOT: "-fprofile-instrument-path=
// CHECK-SAME: "-fprofile-instrument-use-path=a.profdata"
// RUN: %clang -### -c -fprofile-use=a.profdata -fcs-profile-generate=dir %s 2>&1 | FileCheck %s --check-prefix=CHECK1
// CHECK1: "-fprofile-instrument=csllvm"{{.*}} "-fprofile-instrument-path=dir{{/|\\\\}}default_%m.profraw" "-fprofile-instrument-use-path=a.profdata"
/// Degradation case. This usage does not make much sense.
// RUN: %clang -### -c -fcs-profile-generate %s 2>&1 | FileCheck %s --check-prefix=NOUSE
// NOUSE: "-fprofile-instrument=csllvm"
// NOUSE-NOT: "-fprofile-instrument-path=
// RUN: %clang -### -c -fprofile-generate -fcs-profile-generate %s 2>&1 | FileCheck %s --check-prefix=CONFLICT
// CONFLICT: error: invalid argument '-fcs-profile-generate' not allowed with '-fprofile-generate'