[PATCH] MS ABI: Propagate class-level DLL attributes to class template specialization bases (PR11170)

Reid Kleckner rnk at google.com
Wed Jun 25 11:00:52 PDT 2014


Comment at: lib/Sema/SemaDeclCXX.cpp:1310
@@ +1309,3 @@
+  if (BaseTemplateSpec->getSpecializationKind() != TSK_Undeclared) {
+    bool DifferentAttribute = false;
Can you return early if getSpecializationKind() == TSK_Undeclared to reduce indentation?

Comment at: lib/Sema/SemaDeclCXX.cpp:1326-1328
@@ +1325,5 @@
+    // The template was previously instantiated or explicitly specialized
+    // without, or with the wrong kind of, dll attribute. It's too late for us
+    // to change the attribute, so warn that this is unsupported.
+    S.Diag(BaseLoc, diag::warn_attribute_dll_instantiated_base_class)
I think one of the 4 cases you have here is impossible.  An explicitly specialized template will never have a different dll attribute, because it can only have an explicit, non-inherited attribute, in which case we won't try to change the dll attribute.  What do you think of this for the first sentence:

The template was previously instantiated or explicitly specialized without a dll attribute, or the template was previously instantiated with a different inherited dll attribute.


More information about the cfe-commits mailing list