aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-12-10 12:48:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-12-10 12:48:06 +0200
commit437f4e37a5e5de5866f421b94e24fbb4472338bf (patch)
treefb452f6dd0c4c7e121c6429c2e62fb5edce93f1f
parent4266969baa77664a5ffb33e6cb8765d6ce498d89 (diff)
Generate TR1 traits include if TR1 pointer is used as object pointer
-rw-r--r--odb/type-processor.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/odb/type-processor.cxx b/odb/type-processor.cxx
index 502fe7d..b6baf67 100644
--- a/odb/type-processor.cxx
+++ b/odb/type-processor.cxx
@@ -470,6 +470,41 @@ namespace
throw generation_failed ();
tn = TYPE_MAIN_VARIANT (TREE_TYPE (decl));
+
+ // Check if the pointer is a TR1 template instantiation.
+ //
+ if (tree ti = TYPE_TEMPLATE_INFO (t.tree_node ()))
+ {
+ decl = TI_TEMPLATE (ti); // DECL_TEMPLATE
+
+ // Get to the most general template declaration.
+ //
+ while (DECL_TEMPLATE_INFO (decl))
+ decl = DECL_TI_TEMPLATE (decl);
+
+ if (!unit.count ("tr1-pointer-used"))
+ {
+ unit.set ("tr1-pointer-used", false);
+ unit.set ("boost-pointer-used", false);
+ }
+
+ bool& tr1 (unit.get<bool> ("tr1-pointer-used"));
+ bool& boost (unit.get<bool> ("boost-pointer-used"));
+
+ string n (decl_as_string (decl, TFF_PLAIN_IDENTIFIER));
+
+ // In case of a boost TR1 implementation, we cannot distinguish
+ // between the boost:: and std::tr1:: usage since the latter is
+ // just a using-declaration for the former.
+ //
+ tr1 = tr1
+ || n.compare (0, 8, "std::tr1") == 0
+ || n.compare (0, 10, "::std::tr1") == 0;
+
+ boost = boost
+ || n.compare (0, 17, "boost::shared_ptr") == 0
+ || n.compare (0, 19, "::boost::shared_ptr") == 0;
+ }
}
catch (generation_failed const&)
{