Index: base/export_template_type.h |
diff --git a/base/export_template_type.h b/base/export_template_type.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7d55c2c5fb166b3cb82ad38b1849253687b85c29 |
--- /dev/null |
+++ b/base/export_template_type.h |
@@ -0,0 +1,27 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
Mark Mentovai
2013/02/28 15:39:22
2013
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BASE_EXPORT_TEMPLATE_TYPE_H_ |
+#define EXPORT_TEMPLATE_TYPE_H_ |
Mark Mentovai
2013/02/28 15:39:22
This is not the same name that you check for on th
|
+ |
+// Class forward declarations usually don't need to be decorated with EXPORT. |
+// However, clang looks at the visibility of forward declarations for explicit |
+// template instantiations and hides the instantiated symbols if any of the |
+// types isn't visible, so class declarations used in explicit macro |
+// instantiations do need EXPORT. |
+// But gcc warns "type attributes ignored after type is already defined" if |
+// it sees an EXPORT on a class declaration after seeing the class itself (which |
+// can happen depending on include order), so define a macro for this purpose. |
+// To be used like: |
+// |
+// EXPORT_TEMPLATE_TYPE(class, UI_EXPORT, Insets); |
+// extern template class MyTemplate<Insets>; |
+ |
+#if defined(__clang__) |
+#define EXPORT_TEMPLATE_TYPE(kw, export_macro, name) kw export_macro name |
+#else |
+#define EXPORT_TEMPLATE_TYPE(kw, export_macro, name) kw name |
+#endif |
+ |
+#endif // EXPORT_TEMPLATE_TYPE_H_ |