[PATCH] D13330: Implement __attribute__((unique_instantiation))

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 12:57:43 PST 2015


aaron.ballman added a comment.

Modulo the question you and David are discussing about variable templates (for which I don't have an answer handy), I just have a few small testing nits.


================
Comment at: test/SemaCXX/unique-instantiations.cpp:24
@@ +23,3 @@
+template struct foo5<int>;                                              // expected-error{{'unique_instantiation' attribute must be specified for all declarations and definitions of this explicit template instantiation}}
+
+template <typename T>
----------------
> Isn't the correct usage checked for in the CodeGen tests above?

It is, but those are just tests for code generation, which are all expected to succeed semantically. We generally expect tests in Sema (and related folders) that demonstrate successful cases as well as failure cases for features.

================
Comment at: test/SemaCXX/unique-instantiations.cpp:28
@@ +27,2 @@
+extern template struct  __attribute__((unique_instantiation(16))) foo6<int>;    // expected-error{{'unique_instantiation' attribute takes no arguments}}
+template struct __attribute__((unique_instantiation("Hello World"))) foo6<int>; // expected-error{{'unique_instantiation' attribute takes no arguments}}
----------------
The test with unique_instantiation(16) is sufficient, no need for the "Hello World" test as well.


http://reviews.llvm.org/D13330





More information about the cfe-commits mailing list