Files
clang-p2996/clang/test/CodeGenCXX/debug-info-determinism.cpp
Chandler Carruth b41171b70b Fix non-deterministic iteration order when walking the specializations
of templates by using the newly introduce FoldingSetVector. This
preserves insertion order for all iteration of specializations.

I've also included a somewhat terrifying testcase that rapidly builds up
a large number of functions. This is enough that any system with ASLR
will have non-deterministic debug information generated for the test
case without the fix here as the debug information is generated in part
by walking these specializations.

llvm-svn: 156133
2012-05-03 23:49:05 +00:00

17 lines
506 B
C++

// RUN: %clang_cc1 -S -emit-llvm -g -o %t1.ll %s
// RUN: %clang_cc1 -S -emit-llvm -g -o %t2.ll %s
// RUN: diff %t1.ll %t2.ll
template <int N> struct C {
template <int M> int f() {
int arr[M] = {};
return arr[M/2] + C<M/2>().template f<M-1>();
}
};
template <> template <> int C<0>::f<0>() { return 0; }
template <> template <> int C<0>::f<1>() { return 0; }
template <> template <> int C<1>::f<0>() { return 0; }
template <> template <> int C<1>::f<1>() { return 0; }
int x = C<0>().f<64>();