aboutsummaryrefslogtreecommitdiff
path: root/odb/semantics
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-11-15 12:34:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-11-15 12:34:44 +0200
commitde2acaa079cbf6bcb1db8fecd956789360d9dd5c (patch)
tree5f8f2dfaf0cb39d6074b4d77a5654f3b4a476825 /odb/semantics
parentb926362a9c1276ee15b5f961e912d8d37369e40b (diff)
Maintain GCC tree node for all semantic graph nodes
Diffstat (limited to 'odb/semantics')
-rw-r--r--odb/semantics/class-template.cxx6
-rw-r--r--odb/semantics/class-template.hxx2
-rw-r--r--odb/semantics/class.cxx2
-rw-r--r--odb/semantics/derived.cxx14
-rw-r--r--odb/semantics/derived.hxx3
-rw-r--r--odb/semantics/elements.cxx4
-rw-r--r--odb/semantics/elements.hxx44
-rw-r--r--odb/semantics/enum.cxx6
-rw-r--r--odb/semantics/enum.hxx2
-rw-r--r--odb/semantics/fundamental.cxx6
-rw-r--r--odb/semantics/fundamental.hxx53
-rw-r--r--odb/semantics/namespace.cxx4
-rw-r--r--odb/semantics/namespace.hxx6
-rw-r--r--odb/semantics/union-template.cxx6
-rw-r--r--odb/semantics/union-template.hxx2
-rw-r--r--odb/semantics/union.cxx2
-rw-r--r--odb/semantics/unit.cxx4
17 files changed, 61 insertions, 105 deletions
diff --git a/odb/semantics/class-template.cxx b/odb/semantics/class-template.cxx
index ddaf012..0bd3413 100644
--- a/odb/semantics/class-template.cxx
+++ b/odb/semantics/class-template.cxx
@@ -9,8 +9,8 @@
namespace semantics
{
class_template::
- class_template (path const& file, size_t line, size_t column)
- : node (file, line, column)
+ class_template (path const& file, size_t line, size_t column, tree tn)
+ : node (file, line, column, tn)
{
}
@@ -19,7 +19,7 @@ namespace semantics
size_t line,
size_t column,
tree tn)
- : node (file, line, column), type (tn)
+ : node (file, line, column, tn)
{
}
diff --git a/odb/semantics/class-template.hxx b/odb/semantics/class-template.hxx
index 699b617..33f148d 100644
--- a/odb/semantics/class-template.hxx
+++ b/odb/semantics/class-template.hxx
@@ -33,7 +33,7 @@ namespace semantics
}
public:
- class_template (path const&, size_t line, size_t column);
+ class_template (path const&, size_t line, size_t column, tree);
void
add_edge_left (inherits& e)
diff --git a/odb/semantics/class.cxx b/odb/semantics/class.cxx
index c1f494a..47cf438 100644
--- a/odb/semantics/class.cxx
+++ b/odb/semantics/class.cxx
@@ -16,7 +16,7 @@ namespace semantics
class_::
class_ (path const& file, size_t line, size_t column, tree tn)
- : node (file, line, column), type (tn)
+ : node (file, line, column, tn)
{
}
diff --git a/odb/semantics/derived.cxx b/odb/semantics/derived.cxx
index 904ffdd..df25c98 100644
--- a/odb/semantics/derived.cxx
+++ b/odb/semantics/derived.cxx
@@ -8,12 +8,6 @@
namespace semantics
{
- derived_type::
- derived_type (tree tn)
- : type (tn)
- {
- }
-
qualifies::
qualifies ()
{
@@ -27,7 +21,7 @@ namespace semantics
bool c,
bool v,
bool r)
- : node (file, line, column), derived_type (tn), c_ (c), v_ (v), r_ (r)
+ : node (file, line, column, tn), c_ (c), v_ (v), r_ (r)
{
}
@@ -38,7 +32,7 @@ namespace semantics
pointer::
pointer (path const& file, size_t line, size_t column, tree tn)
- : node (file, line, column), derived_type (tn)
+ : node (file, line, column, tn)
{
}
@@ -49,7 +43,7 @@ namespace semantics
reference::
reference (path const& file, size_t line, size_t column, tree tn)
- : node (file, line, column), derived_type (tn)
+ : node (file, line, column, tn)
{
}
@@ -64,7 +58,7 @@ namespace semantics
size_t column,
tree tn,
unsigned long long size)
- : node (file, line, column), derived_type (tn), size_ (size)
+ : node (file, line, column, tn), size_ (size)
{
}
diff --git a/odb/semantics/derived.hxx b/odb/semantics/derived.hxx
index 90b7e3c..db9b201 100644
--- a/odb/semantics/derived.hxx
+++ b/odb/semantics/derived.hxx
@@ -19,9 +19,6 @@ namespace semantics
public:
virtual type&
base_type () const = 0;
-
- protected:
- derived_type (tree);
};
//
diff --git a/odb/semantics/elements.cxx b/odb/semantics/elements.cxx
index 8e62535..728b1b5 100644
--- a/odb/semantics/elements.cxx
+++ b/odb/semantics/elements.cxx
@@ -21,8 +21,8 @@ namespace semantics
//
//
node::
- 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, tree tn)
+ : tree_node_ (tn), file_ (file), line_ (line), column_ (column)
{
}
diff --git a/odb/semantics/elements.hxx b/odb/semantics/elements.hxx
index f5d4954..2e8908e 100644
--- a/odb/semantics/elements.hxx
+++ b/odb/semantics/elements.hxx
@@ -93,6 +93,13 @@ namespace semantics
~node () {}
public:
+ tree
+ tree_node () const
+ {
+ return tree_node_;
+ }
+
+ public:
path const&
file () const
{
@@ -120,7 +127,7 @@ namespace semantics
}
public:
- node (path const& file, size_t line, size_t column);
+ node (path const& file, size_t line, size_t column, tree);
// Sink functions that allow extensions in the form of one-way
// edges.
@@ -136,6 +143,8 @@ namespace semantics
node ();
private:
+ tree tree_node_;
+
path file_;
size_t line_;
size_t column_;
@@ -388,8 +397,8 @@ namespace semantics
find (names&);
public:
- scope (path const& file, size_t line, size_t column)
- : node (file, line, column)
+ scope (path const& file, size_t line, size_t column, tree tn)
+ : node (file, line, column, tn)
{
}
@@ -419,13 +428,6 @@ namespace semantics
typedef std::vector<qualifies*> qualified;
public:
- tree
- tree_node () const
- {
- return tree_node_;
- }
-
- public:
typedef pointer_iterator<qualified::const_iterator> qualified_iterator;
qualified_iterator
@@ -454,23 +456,7 @@ namespace semantics
using nameable::add_edge_right;
- protected:
- type (tree tn)
- : tree_node_ (tn)
- {
- }
-
- // For virtual inheritance. Should never be actually called.
- //
- type ()
- {
- // GCC plugin machinery #define's abort as a macro.
- //
- abort ();
- }
-
private:
- tree tree_node_;
qualified qualified_;
};
@@ -574,8 +560,8 @@ namespace semantics
class data_member: public nameable, public instance
{
public:
- data_member (path const& file, size_t line, size_t column)
- : node (file, line, column)
+ data_member (path const& file, size_t line, size_t column, tree tn)
+ : node (file, line, column, tn)
{
}
};
@@ -597,7 +583,7 @@ namespace semantics
size_t column,
tree tn,
string const& type_name)
- : node (file, line, column), type (tn), type_name_ (type_name)
+ : node (file, line, column, tn), type_name_ (type_name)
{
}
diff --git a/odb/semantics/enum.cxx b/odb/semantics/enum.cxx
index 9d28c1d..fce67f8 100644
--- a/odb/semantics/enum.cxx
+++ b/odb/semantics/enum.cxx
@@ -14,14 +14,14 @@ namespace semantics
}
enumerator::
- enumerator (path const& file, size_t line, size_t column)
- : node (file, line, column)
+ enumerator (path const& file, size_t line, size_t column, tree tn)
+ : node (file, line, column, tn)
{
}
enum_::
enum_ (path const& file, size_t line, size_t column, tree tn)
- : node (file, line, column), type (tn)
+ : node (file, line, column, tn)
{
}
diff --git a/odb/semantics/enum.hxx b/odb/semantics/enum.hxx
index 24fb860..7f124a8 100644
--- a/odb/semantics/enum.hxx
+++ b/odb/semantics/enum.hxx
@@ -72,7 +72,7 @@ namespace semantics
}
public:
- enumerator (path const&, size_t line, size_t column);
+ enumerator (path const&, size_t line, size_t column, tree);
void
add_edge_right (enumerates& e)
diff --git a/odb/semantics/fundamental.cxx b/odb/semantics/fundamental.cxx
index 087a08f..232cd2a 100644
--- a/odb/semantics/fundamental.cxx
+++ b/odb/semantics/fundamental.cxx
@@ -8,12 +8,6 @@
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 70c6162..3ac3551 100644
--- a/odb/semantics/fundamental.hxx
+++ b/odb/semantics/fundamental.hxx
@@ -21,21 +21,16 @@ namespace semantics
virtual string
fq_name (names*) const;
-
- protected:
- fund_type (tree tn);
};
struct fund_void: fund_type
{
- fund_void (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_void (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_bool: fund_type
{
- fund_bool (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_bool (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
//
@@ -44,74 +39,63 @@ namespace semantics
struct fund_char: fund_type
{
- fund_char (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_char (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_wchar: fund_type
{
- fund_wchar (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_wchar (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_signed_char: fund_type
{
- fund_signed_char (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_signed_char (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_unsigned_char: fund_type
{
- fund_unsigned_char (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_unsigned_char (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_short: fund_type
{
- fund_short (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_short (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_unsigned_short: fund_type
{
- fund_unsigned_short (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_unsigned_short (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_int: fund_type
{
- fund_int (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_int (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_unsigned_int: fund_type
{
- fund_unsigned_int (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_unsigned_int (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_long: fund_type
{
- fund_long (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_long (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_unsigned_long: fund_type
{
- fund_unsigned_long (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_unsigned_long (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_long_long: fund_type
{
- fund_long_long (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_long_long (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_unsigned_long_long: fund_type
{
fund_unsigned_long_long (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ : node (path ("<fundamental>"), 0, 0, tn) {}
};
//
@@ -120,20 +104,17 @@ namespace semantics
struct fund_float: fund_type
{
- fund_float (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_float (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_double: fund_type
{
- fund_double (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_double (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
struct fund_long_double: fund_type
{
- fund_long_double (tree tn)
- : node (path ("<fundamental>"), 0, 0), fund_type (tn) {}
+ fund_long_double (tree tn): node (path ("<fundamental>"), 0, 0, tn) {}
};
}
diff --git a/odb/semantics/namespace.cxx b/odb/semantics/namespace.cxx
index a0a9246..b873b79 100644
--- a/odb/semantics/namespace.cxx
+++ b/odb/semantics/namespace.cxx
@@ -9,8 +9,8 @@
namespace semantics
{
namespace_::
- namespace_ (path const& file, size_t line, size_t column)
- : node (file, line, column)
+ namespace_ (path const& file, size_t line, size_t column, tree tn)
+ : node (file, line, column, tn)
{
}
diff --git a/odb/semantics/namespace.hxx b/odb/semantics/namespace.hxx
index 105ed0b..ea09228 100644
--- a/odb/semantics/namespace.hxx
+++ b/odb/semantics/namespace.hxx
@@ -13,12 +13,14 @@ namespace semantics
class namespace_: public scope
{
public:
- namespace_ (path const&, size_t line, size_t column);
- namespace_ ();
+ namespace_ (path const&, size_t line, size_t column, tree);
// Resolve conflict between scope::scope and nameable::scope.
//
using nameable::scope;
+
+ protected:
+ namespace_ ();
};
}
diff --git a/odb/semantics/union-template.cxx b/odb/semantics/union-template.cxx
index c0ab198..ae95c60 100644
--- a/odb/semantics/union-template.cxx
+++ b/odb/semantics/union-template.cxx
@@ -9,8 +9,8 @@
namespace semantics
{
union_template::
- union_template (path const& file, size_t line, size_t column)
- : node (file, line, column)
+ union_template (path const& file, size_t line, size_t column, tree tn)
+ : node (file, line, column, tn)
{
}
@@ -19,7 +19,7 @@ namespace semantics
size_t line,
size_t column,
tree tn)
- : node (file, line, column), type (tn)
+ : node (file, line, column, tn)
{
}
diff --git a/odb/semantics/union-template.hxx b/odb/semantics/union-template.hxx
index 54bf447..49b820e 100644
--- a/odb/semantics/union-template.hxx
+++ b/odb/semantics/union-template.hxx
@@ -15,7 +15,7 @@ namespace semantics
class union_template: public type_template, public scope
{
public:
- union_template (path const&, size_t line, size_t column);
+ union_template (path const&, size_t line, size_t column, tree);
// Resolve conflict between scope::scope and nameable::scope.
//
diff --git a/odb/semantics/union.cxx b/odb/semantics/union.cxx
index 5acc21f..7eb6fbd 100644
--- a/odb/semantics/union.cxx
+++ b/odb/semantics/union.cxx
@@ -10,7 +10,7 @@ namespace semantics
{
union_::
union_ (path const& file, size_t line, size_t column, tree tn)
- : node (file, line, column), type (tn)
+ : node (file, line, column, tn)
{
}
diff --git a/odb/semantics/unit.cxx b/odb/semantics/unit.cxx
index 3540e15..56d4f87 100644
--- a/odb/semantics/unit.cxx
+++ b/odb/semantics/unit.cxx
@@ -3,6 +3,8 @@
// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
// license : GNU GPL v3; see accompanying LICENSE file
+#include <odb/gcc.hxx>
+
#include <cutl/compiler/type-info.hxx>
#include <odb/semantics/unit.hxx>
@@ -10,7 +12,7 @@ namespace semantics
{
unit::
unit (path const& file)
- : node (file, 1, 1), graph_ (*this)
+ : node (file, 1, 1, global_namespace), graph_ (*this)
{
// Use a special edge to get this->name() return the global
// namespace name ("").