From 7d1a8bc0e5011dd2b391608a207cf436b388576e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 2 Sep 2010 22:21:11 +0200 Subject: Move constructors to the source files This is done so that when the plugin is built as a static library, the object files with type information get pulled in. --- odb/semantics/class-template.cxx | 15 ++++++++++ odb/semantics/class-template.hxx | 13 ++------- odb/semantics/class.cxx | 12 ++++++++ odb/semantics/class.hxx | 10 ++----- odb/semantics/derived.cxx | 60 ++++++++++++++++++++++++++++++++++++++++ odb/semantics/derived.hxx | 49 +++++++++----------------------- odb/semantics/elements.cxx | 18 ++++++++++++ odb/semantics/elements.hxx | 14 ++-------- odb/semantics/enum.cxx | 17 ++++++++++++ odb/semantics/enum.hxx | 14 ++-------- odb/semantics/fundamental.cxx | 6 ++++ odb/semantics/fundamental.hxx | 3 +- odb/semantics/namespace.cxx | 11 ++++++++ odb/semantics/namespace.hxx | 10 ++----- odb/semantics/template.cxx | 25 +++++++++++++++++ odb/semantics/template.hxx | 20 ++++---------- odb/semantics/union-template.cxx | 15 ++++++++++ odb/semantics/union-template.hxx | 13 ++------- odb/semantics/union.cxx | 6 ++++ odb/semantics/union.hxx | 5 +--- odb/semantics/unit.cxx | 10 +++++++ odb/semantics/unit.hxx | 9 +----- 22 files changed, 229 insertions(+), 126 deletions(-) diff --git a/odb/semantics/class-template.cxx b/odb/semantics/class-template.cxx index 20c8ba7..516afca 100644 --- a/odb/semantics/class-template.cxx +++ b/odb/semantics/class-template.cxx @@ -8,6 +8,21 @@ namespace semantics { + class_template:: + class_template (path const& file, size_t line, size_t column) + : node (file, line, column) + { + } + + class_instantiation:: + class_instantiation (path const& file, + size_t line, + size_t column, + tree tn) + : node (file, line, column), type (tn) + { + } + // type info // namespace diff --git a/odb/semantics/class-template.hxx b/odb/semantics/class-template.hxx index 7d069ec..730d6bb 100644 --- a/odb/semantics/class-template.hxx +++ b/odb/semantics/class-template.hxx @@ -33,10 +33,7 @@ namespace semantics } public: - class_template (path const& file, size_t line, size_t column) - : node (file, line, column) - { - } + class_template (path const&, size_t line, size_t column); void add_edge_left (inherits& e) @@ -63,13 +60,7 @@ namespace semantics class class_instantiation: public class_, public type_instantiation { public: - class_instantiation (path const& file, - size_t line, - size_t column, - tree tn) - : node (file, line, column), type (tn) - { - } + class_instantiation (path const&, size_t line, size_t column, tree); using class_::add_edge_left; using type_instantiation::add_edge_left; diff --git a/odb/semantics/class.cxx b/odb/semantics/class.cxx index b408d05..b4a42d1 100644 --- a/odb/semantics/class.cxx +++ b/odb/semantics/class.cxx @@ -8,6 +8,18 @@ namespace semantics { + inherits:: + inherits (access_type access, bool virt) + : virt_ (virt), access_ (access) + { + } + + class_:: + class_ (path const& file, size_t line, size_t column, tree tn) + : node (file, line, column), type (tn) + { + } + // type info // namespace diff --git a/odb/semantics/class.hxx b/odb/semantics/class.hxx index bb5dec3..72dcfea 100644 --- a/odb/semantics/class.hxx +++ b/odb/semantics/class.hxx @@ -43,10 +43,7 @@ namespace semantics } public: - inherits (access_type access, bool virt) - : virt_ (virt), access_ (access) - { - } + inherits (access_type, bool virt); void set_left_node (class_& n) @@ -91,10 +88,7 @@ namespace semantics } public: - class_ (path const& file, size_t line, size_t column, tree tn) - : node (file, line, column), type (tn) - { - } + class_ (path const&, size_t line, size_t column, tree); void add_edge_left (inherits& e) diff --git a/odb/semantics/derived.cxx b/odb/semantics/derived.cxx index 5f33d5a..78975ca 100644 --- a/odb/semantics/derived.cxx +++ b/odb/semantics/derived.cxx @@ -8,6 +8,66 @@ namespace semantics { + derived_type:: + derived_type (tree tn) + : type (tn) + { + } + + qualifies:: + qualifies () + { + } + + qualifier:: + qualifier (path const& file, + size_t line, + size_t column, + tree tn, + bool c, + bool v, + bool r) + : node (file, line, column), derived_type (tn), c_ (c), v_ (v), r_ (r) + { + } + + points:: + points () + { + } + + pointer:: + pointer (path const& file, size_t line, size_t column, tree tn) + : node (file, line, column), derived_type (tn) + { + } + + references:: + references () + { + } + + reference:: + reference (path const& file, size_t line, size_t column, tree tn) + : node (file, line, column), derived_type (tn) + { + } + + contains:: + contains () + { + } + + array:: + array (path const& file, + size_t line, + size_t column, + tree tn, + unsigned long long size) + : node (file, line, column), derived_type (tn), size_ (size) + { + } + // type info // namespace diff --git a/odb/semantics/derived.hxx b/odb/semantics/derived.hxx index e7c0e51..409980c 100644 --- a/odb/semantics/derived.hxx +++ b/odb/semantics/derived.hxx @@ -21,10 +21,7 @@ namespace semantics base_type () const = 0; protected: - derived_type (tree tn) - : type (tn) - { - } + derived_type (tree); }; // @@ -50,9 +47,7 @@ namespace semantics } public: - qualifies () - { - } + qualifies (); void set_left_node (qualifier_type& n) @@ -107,16 +102,13 @@ namespace semantics } public: - qualifier (path const& file, + qualifier (path const&, size_t line, size_t column, - tree tn, + tree, bool c, bool v, - bool r) - : node (file, line, column), derived_type (tn), c_ (c), v_ (v), r_ (r) - { - } + bool r); void add_edge_left (qualifies_type& e) @@ -152,9 +144,7 @@ namespace semantics } public: - points () - { - } + points (); void set_left_node (pointer_type& n) @@ -191,10 +181,7 @@ namespace semantics } public: - pointer (path const& file, size_t line, size_t column, tree tn) - : node (file, line, column), derived_type (tn) - { - } + pointer (path const&, size_t line, size_t column, tree); void add_edge_left (points_type& e) @@ -230,9 +217,7 @@ namespace semantics } public: - references () - { - } + references (); void set_left_node (reference_type& n) @@ -269,10 +254,7 @@ namespace semantics } public: - reference (path const& file, size_t line, size_t column, tree tn) - : node (file, line, column), derived_type (tn) - { - } + reference (path const&, size_t line, size_t column, tree); void add_edge_left (references_type& e) @@ -308,9 +290,7 @@ namespace semantics } public: - contains () - { - } + contains (); void set_left_node (array_type& n) @@ -356,14 +336,11 @@ namespace semantics } public: - array (path const& file, + array (path const&, size_t line, size_t column, - tree tn, - unsigned long long size) - : node (file, line, column), derived_type (tn), size_ (size) - { - } + tree, + unsigned long long size); void add_edge_left (contains_type& e) diff --git a/odb/semantics/elements.cxx b/odb/semantics/elements.cxx index a25df86..341de3c 100644 --- a/odb/semantics/elements.cxx +++ b/odb/semantics/elements.cxx @@ -18,6 +18,24 @@ namespace semantics return access_str[value_]; } + // + // + node:: + node (path const& file, size_t line, size_t column) + : file_ (file), line_ (line), column_ (column) + { + } + + node:: + node () + : file_ ("") + { + // GCC plugin machinery #define's abort as a macro. + // + // std::abort (); + abort (); + } + // nameable // diff --git a/odb/semantics/elements.hxx b/odb/semantics/elements.hxx index 03925f5..023e3a2 100644 --- a/odb/semantics/elements.hxx +++ b/odb/semantics/elements.hxx @@ -120,10 +120,7 @@ namespace semantics } public: - node (path const& file, size_t line, size_t column) - : file_ (file), line_ (line), column_ (column) - { - } + node (path const& file, size_t line, size_t column); // Sink functions that allow extensions in the form of one-way // edges. @@ -136,14 +133,7 @@ namespace semantics protected: // For virtual inheritance. Should never be actually called. // - node () - : file_ ("") - { - // GCC plugin machinery #define's abort as a macro. - // - //std::abort (); - abort (); - } + node (); private: path file_; diff --git a/odb/semantics/enum.cxx b/odb/semantics/enum.cxx index ea23d1e..31afb83 100644 --- a/odb/semantics/enum.cxx +++ b/odb/semantics/enum.cxx @@ -8,6 +8,23 @@ namespace semantics { + enumerates:: + enumerates () + { + } + + enumerator:: + enumerator (path const& file, size_t line, size_t column) + : node (file, line, column) + { + } + + enum_:: + enum_ (path const& file, size_t line, size_t column, tree tn) + : node (file, line, column), type (tn) + { + } + // type info // namespace diff --git a/odb/semantics/enum.hxx b/odb/semantics/enum.hxx index b03a56c..5dc6d50 100644 --- a/odb/semantics/enum.hxx +++ b/odb/semantics/enum.hxx @@ -33,9 +33,7 @@ namespace semantics } public: - enumerates () - { - } + enumerates (); void set_left_node (enum_type& n) @@ -74,10 +72,7 @@ namespace semantics } public: - enumerator (path const& file, size_t line, size_t column) - : node (file, line, column) - { - } + enumerator (path const&, size_t line, size_t column); void add_edge_right (enumerates& e) @@ -116,10 +111,7 @@ namespace semantics } public: - enum_ (path const& file, size_t line, size_t column, tree tn) - : node (file, line, column), type (tn) - { - } + enum_ (path const&, size_t line, size_t column, tree); void add_edge_left (enumerates& e) diff --git a/odb/semantics/fundamental.cxx b/odb/semantics/fundamental.cxx index 76efbe4..c48d23c 100644 --- a/odb/semantics/fundamental.cxx +++ b/odb/semantics/fundamental.cxx @@ -8,6 +8,12 @@ namespace semantics { + fund_type:: + fund_type (tree tn) + : type (tn) + { + } + string fund_type:: fq_name () const { diff --git a/odb/semantics/fundamental.hxx b/odb/semantics/fundamental.hxx index 991bc54..f7751a8 100644 --- a/odb/semantics/fundamental.hxx +++ b/odb/semantics/fundamental.hxx @@ -23,8 +23,7 @@ namespace semantics fq_name (names*) const; protected: - fund_type (tree tn) - : type (tn) {} + fund_type (tree tn); }; struct fund_void: fund_type diff --git a/odb/semantics/namespace.cxx b/odb/semantics/namespace.cxx index 797b53d..0181309 100644 --- a/odb/semantics/namespace.cxx +++ b/odb/semantics/namespace.cxx @@ -8,6 +8,17 @@ namespace semantics { + namespace_:: + namespace_ (path const& file, size_t line, size_t column) + : node (file, line, column) + { + } + + namespace_:: + namespace_ () + { + } + // type info // namespace diff --git a/odb/semantics/namespace.hxx b/odb/semantics/namespace.hxx index 936a8c7..c7fcef6 100644 --- a/odb/semantics/namespace.hxx +++ b/odb/semantics/namespace.hxx @@ -13,14 +13,8 @@ namespace semantics class namespace_: public scope { public: - namespace_ (path const& file, size_t line, size_t column) - : node (file, line, column) - { - } - - namespace_ () - { - } + namespace_ (path const&, size_t line, size_t column); + namespace_ (); // Resolve conflict between scope::scope and nameable::scope. // diff --git a/odb/semantics/template.cxx b/odb/semantics/template.cxx index 4a3df79..9c7af0b 100644 --- a/odb/semantics/template.cxx +++ b/odb/semantics/template.cxx @@ -8,6 +8,31 @@ namespace semantics { + template_:: + template_ () + { + } + + instantiates:: + instantiates () + { + } + + instantiation:: + instantiation () + { + } + + type_template:: + type_template () + { + } + + type_instantiation:: + type_instantiation () + { + } + // type info // namespace diff --git a/odb/semantics/template.hxx b/odb/semantics/template.hxx index b610cfb..8667dc6 100644 --- a/odb/semantics/template.hxx +++ b/odb/semantics/template.hxx @@ -46,9 +46,7 @@ namespace semantics using nameable::add_edge_right; protected: - template_ () - { - } + template_ (); private: instantiated instantiated_; @@ -77,9 +75,7 @@ namespace semantics } public: - instantiates () - { - } + instantiates (); void set_left_node (instantiation_type& n) @@ -126,9 +122,7 @@ namespace semantics } protected: - instantiation () - { - } + instantiation (); private: instantiates_type* instantiates_; @@ -141,17 +135,13 @@ namespace semantics class type_template: public template_ { protected: - type_template () - { - } + type_template (); }; class type_instantiation: public virtual type, public instantiation { protected: - type_instantiation () - { - } + type_instantiation (); }; } diff --git a/odb/semantics/union-template.cxx b/odb/semantics/union-template.cxx index 6aa192b..ea235e7 100644 --- a/odb/semantics/union-template.cxx +++ b/odb/semantics/union-template.cxx @@ -8,6 +8,21 @@ namespace semantics { + union_template:: + union_template (path const& file, size_t line, size_t column) + : node (file, line, column) + { + } + + union_instantiation:: + union_instantiation (path const& file, + size_t line, + size_t column, + tree tn) + : node (file, line, column), type (tn) + { + } + // type info // namespace diff --git a/odb/semantics/union-template.hxx b/odb/semantics/union-template.hxx index 4b0df27..e14c3c6 100644 --- a/odb/semantics/union-template.hxx +++ b/odb/semantics/union-template.hxx @@ -15,10 +15,7 @@ namespace semantics class union_template: public type_template, public scope { public: - union_template (path const& file, size_t line, size_t column) - : node (file, line, column) - { - } + union_template (path const&, size_t line, size_t column); // Resolve conflict between scope::scope and nameable::scope. // @@ -28,13 +25,7 @@ namespace semantics class union_instantiation: public union_, public type_instantiation { public: - union_instantiation (path const& file, - size_t line, - size_t column, - tree tn) - : node (file, line, column), type (tn) - { - } + union_instantiation (path const&, size_t line, size_t column, tree); using union_::add_edge_left; using type_instantiation::add_edge_left; diff --git a/odb/semantics/union.cxx b/odb/semantics/union.cxx index ae2f46e..3e2051a 100644 --- a/odb/semantics/union.cxx +++ b/odb/semantics/union.cxx @@ -8,6 +8,12 @@ namespace semantics { + union_:: + union_ (path const& file, size_t line, size_t column, tree tn) + : node (file, line, column), type (tn) + { + } + // type info // namespace diff --git a/odb/semantics/union.hxx b/odb/semantics/union.hxx index 2f441ca..bd95724 100644 --- a/odb/semantics/union.hxx +++ b/odb/semantics/union.hxx @@ -13,10 +13,7 @@ namespace semantics class union_: public virtual type, public scope { public: - union_ (path const& file, size_t line, size_t column, tree tn) - : node (file, line, column), type (tn) - { - } + union_ (path const&, size_t line, size_t column, tree); // Resolve conflict between scope::scope and nameable::scope. // diff --git a/odb/semantics/unit.cxx b/odb/semantics/unit.cxx index 260b1c6..15b2c6e 100644 --- a/odb/semantics/unit.cxx +++ b/odb/semantics/unit.cxx @@ -8,6 +8,16 @@ namespace semantics { + unit:: + unit (path const& file) + : node (file, 1, 1), graph_ (*this) + { + // Use a special edge to get this->name() return the global + // namespace name (""). + // + new_edge (*this, *this); + } + // type info // namespace diff --git a/odb/semantics/unit.hxx b/odb/semantics/unit.hxx index 41cb39b..b078521 100644 --- a/odb/semantics/unit.hxx +++ b/odb/semantics/unit.hxx @@ -16,14 +16,7 @@ namespace semantics class unit: public graph, public namespace_ { public: - unit (path const& file) - : node (file, 1, 1), graph_ (*this) - { - // Use a special edge to get this->name() return the global - // namespace name (""). - // - new_edge (*this, *this); - } + unit (path const&); // Mapping from tree nodes to semantic graph nodes. // -- cgit v1.1