Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3910)

Unified Diff: base/export_template_type.h

Issue 12328142: Mark types used in template instantiatious explicitly as visible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base.gypi ('k') | cc/occlusion_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « base/base.gypi ('k') | cc/occlusion_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698