xref: /aosp_15_r20/external/compiler-rt/test/profile/Inputs/instrprof-comdat.h (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot // Template instantiations are placed into comdat sections. Check that
2*7c3d14c8STreehugger Robot // coverage data from different instantiations are mapped back to the correct
3*7c3d14c8STreehugger Robot // source regions.
4*7c3d14c8STreehugger Robot 
5*7c3d14c8STreehugger Robot template <class T> class FOO {
6*7c3d14c8STreehugger Robot public:
FOO()7*7c3d14c8STreehugger Robot   FOO() : t(0) {}
8*7c3d14c8STreehugger Robot 
9*7c3d14c8STreehugger Robot   T DoIt(T ti);
10*7c3d14c8STreehugger Robot 
11*7c3d14c8STreehugger Robot private:
12*7c3d14c8STreehugger Robot   T t;
13*7c3d14c8STreehugger Robot };
14*7c3d14c8STreehugger Robot 
DoIt(T ti)15*7c3d14c8STreehugger Robot template <class T> T FOO<T>::DoIt(T ti) { // HEADER:  2| [[@LINE]]|template
16*7c3d14c8STreehugger Robot   for (T I = 0; I < ti; I++) {            // HEADER: 22| [[@LINE]]|  for (T
17*7c3d14c8STreehugger Robot     t += I;                               // HEADER: 20| [[@LINE]]|    t += I;
18*7c3d14c8STreehugger Robot     if (I > ti / 2)                       // HEADER: 20| [[@LINE]]|    if (I > ti
19*7c3d14c8STreehugger Robot       t -= 1;                             // HEADER:  8| [[@LINE]]|      t -= 1;
20*7c3d14c8STreehugger Robot   }                                       // HEADER: 10| [[@LINE]]|  }
21*7c3d14c8STreehugger Robot                                           // HEADER:  1| [[@LINE]]|
22*7c3d14c8STreehugger Robot   return t;                               // HEADER:  1| [[@LINE]]|  return t;
23*7c3d14c8STreehugger Robot }
24