blob: e61ad02d07572d19d9a644027619f10bdd7820bc [file] [log] [blame]
Justin Bognerffaa2332014-03-11 06:49:34 +00001// Test that outdated data is ignored.
2
Justin Bognere2ef2a02014-04-15 21:22:35 +00003// FIXME: It would be nice to use -verify here instead of FileCheck, but -verify
4// doesn't play well with warnings that have no line number.
Justin Bognerffaa2332014-03-11 06:49:34 +00005
Justin Bogner534f14a2014-04-17 22:49:06 +00006// RUN: llvm-profdata merge %S/Inputs/c-outdated-data.proftext -o %t.profdata
Rong Xu9c6f1532016-03-02 20:59:36 +00007// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-outdated-data.c %s -o /dev/null -emit-llvm -fprofile-instrument-use-path=%t.profdata -Wprofile-instr-dropped 2>&1 | FileCheck %s
Justin Bognere2ef2a02014-04-15 21:22:35 +00008// CHECK: warning: profile data may be out of date: of 3 functions, 1 has no data and 1 has mismatched data that will be ignored
Justin Bognerffaa2332014-03-11 06:49:34 +00009
Justin Bognerffaa2332014-03-11 06:49:34 +000010void no_usable_data() {
11 int i = 0;
12
13 if (i) {}
14
15#ifdef GENERATE_OUTDATED_DATA
16 if (i) {}
17#endif
Justin Bognerffaa2332014-03-11 06:49:34 +000018}
19
Justin Bognere2ef2a02014-04-15 21:22:35 +000020#ifndef GENERATE_OUTDATED_DATA
21void no_data() {
22}
23#endif
24
Justin Bognerffaa2332014-03-11 06:49:34 +000025int main(int argc, const char *argv[]) {
26 no_usable_data();
27 return 0;
28}