xref: /aosp_15_r20/external/llvm/test/tools/llvm-cov/Inputs/instrprof-comdat.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker template <class T> class FOO {
2*9880d681SAndroid Build Coastguard Worker public:
FOO()3*9880d681SAndroid Build Coastguard Worker   FOO() : t(0) {}
4*9880d681SAndroid Build Coastguard Worker 
5*9880d681SAndroid Build Coastguard Worker   T DoIt(T ti);
6*9880d681SAndroid Build Coastguard Worker 
7*9880d681SAndroid Build Coastguard Worker private:
8*9880d681SAndroid Build Coastguard Worker   T t;
9*9880d681SAndroid Build Coastguard Worker };
10*9880d681SAndroid Build Coastguard Worker 
DoIt(T ti)11*9880d681SAndroid Build Coastguard Worker template <class T> T FOO<T>::DoIt(T ti) { // HEADER:  2| [[@LINE]]|template
12*9880d681SAndroid Build Coastguard Worker   for (T I = 0; I < ti; I++) {            // HEADER: 22| [[@LINE]]|  for (T
13*9880d681SAndroid Build Coastguard Worker     t += I;                               // HEADER: 20| [[@LINE]]|    t += I;
14*9880d681SAndroid Build Coastguard Worker     if (I > ti / 2)                       // HEADER: 20| [[@LINE]]|    if (I > ti
15*9880d681SAndroid Build Coastguard Worker       t -= 1;                             // HEADER:  8| [[@LINE]]|      t -= 1;
16*9880d681SAndroid Build Coastguard Worker   }                                       // HEADER: 20| [[@LINE]]|  }
17*9880d681SAndroid Build Coastguard Worker                                           // HEADER:  2| [[@LINE]]|
18*9880d681SAndroid Build Coastguard Worker   return t;                               // HEADER:  2| [[@LINE]]|  return t;
19*9880d681SAndroid Build Coastguard Worker }
20*9880d681SAndroid Build Coastguard Worker 
21*9880d681SAndroid Build Coastguard Worker // To generate the binaries which correspond to this file, you must first
22*9880d681SAndroid Build Coastguard Worker // compile a program with two calls to Foo<int>::DoIt(10) for each desired
23*9880d681SAndroid Build Coastguard Worker // architecture. Collect a raw profile from any one of these binaries, index
24*9880d681SAndroid Build Coastguard Worker // it, and check it in along with the executables.
25