aboutsummaryrefslogtreecommitdiff
path: root/odb
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-05-25 12:07:44 -0400
committerBoris Kolpackov <boris@codesynthesis.com>2013-05-25 12:07:44 -0400
commitd4cbe214123574469ccdefdfe2e4ef51526b9606 (patch)
tree342feb8cc19280a0a29a97508a55f5c8f51fb96b /odb
parent6662b543002f45f41e78443ac25f748406a911c4 (diff)
Don't generate explicit query template instantiations for reuse-abstract classes
It is unnecessary plus there is no table name.
Diffstat (limited to 'odb')
-rw-r--r--odb/common-query.cxx36
1 files changed, 23 insertions, 13 deletions
diff --git a/odb/common-query.cxx b/odb/common-query.cxx
index b15515c..68fcb21 100644
--- a/odb/common-query.cxx
+++ b/odb/common-query.cxx
@@ -835,22 +835,31 @@ traverse (type& c)
//
if (!ext.empty ())
{
- os << "#ifdef " << ext << endl
- << endl;
+ bool has_ptr (has_a (c, test_pointer | exclude_base));
+ bool reuse_abst (abstract (c) && !polymorphic (c));
- if (has_a (c, test_pointer | exclude_base))
+ if (has_ptr || !reuse_abst)
{
- bool true_ (true); //@@ (im)perfect forwarding.
- bool false_ (false);
+ os << "#ifdef " << ext << endl
+ << endl;
- instance<query_columns_base> t (c, false_, true_);
- t->traverse (c);
- }
+ if (has_ptr)
+ {
+ bool true_ (true); //@@ (im)perfect forwarding.
+ bool false_ (false);
- generate_inst (c);
+ instance<query_columns_base> t (c, false_, true_);
+ t->traverse (c);
+ }
- os << "#endif // " << ext << endl
- << endl;
+ // Don't generate it for reuse-abstract classes.
+ //
+ if (!reuse_abst)
+ generate_inst (c);
+
+ os << "#endif // " << ext << endl
+ << endl;
+ }
}
}
else
@@ -877,9 +886,10 @@ traverse (type& c)
t->traverse (c);
}
- // Explicit template instantiations.
+ // Explicit template instantiations. Don't generate it for reuse-
+ // abstract classes.
//
- if (multi_dynamic)
+ if (multi_dynamic && (!abstract (c) || polymorphic (c)))
generate_inst (c);
}
}