[PATCH] D13330: Implement __attribute__((unique_instantiation))
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 6 06:50:46 PST 2015
aaron.ballman added inline comments.
================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2456
@@ -2450,1 +2455,3 @@
+def err_unique_instantiation_not_previous : Error<
+ "'unique_instantiation' attribute must be specified for all declarations and definitions of this explicit template instantiation">;
----------------
> They are checking for two different conditions in the spec. One requires that all explicit template instantiations with this attribute have a declaration, the other that every declaration/definition has the attribute.
Okay, I see now what this diagnostic is attempting to convey. I think it should read:
```
def err_unique_instantiation_no_declaration : Error<
"'unique_instantiation' attribute on an explicit instantiation requires a previous explicit instantiation declaration">;
```
================
Comment at: test/SemaCXX/unique-instantiations.cpp:5
@@ +4,3 @@
+struct foo1 {};
+template struct __attribute__((unique_instantiation)) foo1<int>; // expected-error{{requires a previous declaration}}
+
----------------
Please spell the entire diagnostic out in expected-error (applies to entire file).
================
Comment at: test/SemaCXX/unique-instantiations.cpp:23
@@ +22,2 @@
+extern template struct __attribute__((unique_instantiation)) foo5<int>; // expected-note{{previous explicit instantiation is here}}
+template struct foo5<int>; // expected-error{{must be specified for all declarations}}
----------------
Missing tests for correct usage of the attribute. Missing tests of the attribute diagnosing when given arguments.
Repository:
rL LLVM
http://reviews.llvm.org/D13330
More information about the cfe-commits
mailing list