2016-02-05 02:39:09 +08:00
|
|
|
// RUN: %clang_cc1 -triple %itanium_abi_triple -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name classtemplate.cpp %s > %tmapping
|
2014-08-21 01:29:47 +08:00
|
|
|
// RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-CONSTRUCTOR
|
|
|
|
// RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-GETTER
|
|
|
|
// RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-SETTER
|
2014-08-20 01:32:30 +08:00
|
|
|
|
|
|
|
template<class TT>
|
|
|
|
class Test {
|
|
|
|
public:
|
|
|
|
enum BaseType {
|
|
|
|
A, C, G, T, Invalid
|
|
|
|
};
|
|
|
|
const static int BaseCount = 4;
|
|
|
|
double bases[BaseCount];
|
|
|
|
|
2014-11-18 08:34:46 +08:00
|
|
|
// CHECK-CONSTRUCTOR: _ZN4TestIjEC
|
2015-02-04 05:35:49 +08:00
|
|
|
Test() { } // CHECK-CONSTRUCTOR: File 0, [[@LINE]]:10 -> [[@LINE]]:13 = #0
|
2014-11-18 08:34:46 +08:00
|
|
|
|
|
|
|
// FIXME: It would be nice to emit no-coverage for get, but trying to do this
|
|
|
|
// runs afoul of cases like Test3::unmangleable below.
|
|
|
|
// FIXME-GETTER: _ZNK4TestIjE3get
|
2015-02-04 05:35:49 +08:00
|
|
|
double get(TT position) const { // FIXME-GETTER: File 0, [[@LINE]]:33 -> [[@LINE+2]]:4 = 0
|
2014-08-20 01:32:30 +08:00
|
|
|
return bases[position];
|
|
|
|
}
|
2014-11-18 08:34:46 +08:00
|
|
|
// CHECK-SETTER: _ZN4TestIjE3set
|
2015-02-04 05:35:49 +08:00
|
|
|
void set(TT position, double value) { // CHECK-SETTER: File 0, [[@LINE]]:39 -> [[@LINE+2]]:4 = #0
|
2014-08-20 01:32:30 +08:00
|
|
|
bases[position] = value;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-11-18 08:34:46 +08:00
|
|
|
class Test2 {
|
|
|
|
// CHECK-CONSTRUCTOR: _ZN5Test2C
|
2015-02-04 05:35:49 +08:00
|
|
|
Test2() { } // CHECK-CONSTRUCTOR: File 0, [[@LINE]]:11 -> [[@LINE]]:14 = 0
|
2014-11-18 08:34:46 +08:00
|
|
|
// CHECK-GETTER: _ZNK5Test23get
|
2015-02-04 05:35:49 +08:00
|
|
|
double get(unsigned position) const { // CHECK-GETTER: File 0, [[@LINE]]:39 -> [[@LINE+2]]:4 = 0
|
2014-11-18 08:34:46 +08:00
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Test3::unmangleable can't be mangled, since there isn't a complete type for
|
|
|
|
// the __is_final type trait expression. This would cause errors if we try to
|
|
|
|
// emit a no-coverage mapping for the method.
|
|
|
|
template <class T, bool = __is_final(T)> class UninstantiatedClassWithTraits {};
|
|
|
|
template <class T> class Test3 {
|
|
|
|
void unmangleable(UninstantiatedClassWithTraits<T> x) {}
|
|
|
|
};
|
|
|
|
|
2014-08-20 01:32:30 +08:00
|
|
|
int main() {
|
|
|
|
Test<unsigned> t;
|
|
|
|
t.set(Test<unsigned>::A, 5.5);
|
|
|
|
t.set(Test<unsigned>::T, 5.6);
|
|
|
|
t.set(Test<unsigned>::G, 5.7);
|
|
|
|
t.set(Test<unsigned>::C, 5.8);
|
|
|
|
return 0;
|
|
|
|
}
|