From 174f6e5d0f370ddfe28ace6acfb5362cfb102280 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 11 Oct 2009 09:32:17 +0200 Subject: Simplify to work around VC++ bugs --- cli/semantics/class.hxx | 4 +--- cli/semantics/elements.hxx | 24 +++++------------------- cli/semantics/expression.hxx | 4 +--- cli/semantics/namespace.hxx | 4 +--- cli/semantics/option.hxx | 12 +++--------- cli/semantics/unit.hxx | 44 +++++++++++++------------------------------- 6 files changed, 24 insertions(+), 68 deletions(-) (limited to 'cli/semantics') diff --git a/cli/semantics/class.hxx b/cli/semantics/class.hxx index 1e6b59c..97717bc 100644 --- a/cli/semantics/class.hxx +++ b/cli/semantics/class.hxx @@ -12,9 +12,7 @@ namespace semantics { class class_: public scope { - protected: - friend class graph; - + public: class_ (path const& file, size_t line, size_t column) : node (file, line, column) { diff --git a/cli/semantics/elements.hxx b/cli/semantics/elements.hxx index 504779a..ecca9ed 100644 --- a/cli/semantics/elements.hxx +++ b/cli/semantics/elements.hxx @@ -72,9 +72,6 @@ namespace semantics return dynamic_cast (this) != 0; } - protected: - friend class graph; - private: context_type context_; }; @@ -123,9 +120,7 @@ namespace semantics return dynamic_cast (this) != 0; } - protected: - friend class graph; - + public: node (path const& file, size_t line, size_t column) : file_ (file), line_ (line), column_ (column) { @@ -202,9 +197,7 @@ namespace semantics return *named_; } - protected: - friend class graph; - + public: names (string const& name) { names_.push_back (name); @@ -273,9 +266,7 @@ namespace semantics return *named_; } - protected: - friend class graph; - + public: nameable () : named_ (0) { @@ -350,9 +341,7 @@ namespace semantics names_iterator find (names&); - protected: - friend class graph; - + public: scope (path const& file, size_t line, size_t column) : node (file, line, column) { @@ -368,7 +357,6 @@ namespace semantics void remove_edge_left (names&); - protected: using nameable::add_edge_right; private: @@ -388,9 +376,7 @@ namespace semantics return name_; } - protected: - friend class graph; - + public: type (path const& file, size_t line, size_t column, string const& name) : node (file, line, column), name_ (name) { diff --git a/cli/semantics/expression.hxx b/cli/semantics/expression.hxx index 00f62da..16d09c7 100644 --- a/cli/semantics/expression.hxx +++ b/cli/semantics/expression.hxx @@ -50,9 +50,7 @@ namespace semantics return *initializes_; } - protected: - friend class graph; - + public: expression (path const& file, size_t line, size_t column, diff --git a/cli/semantics/namespace.hxx b/cli/semantics/namespace.hxx index f05798e..466ad4f 100644 --- a/cli/semantics/namespace.hxx +++ b/cli/semantics/namespace.hxx @@ -12,9 +12,7 @@ namespace semantics { class namespace_: public scope { - protected: - friend class graph; - + public: namespace_ (path const& file, size_t line, size_t column) : node (file, line, column) { diff --git a/cli/semantics/option.hxx b/cli/semantics/option.hxx index 21fc900..d5437e1 100644 --- a/cli/semantics/option.hxx +++ b/cli/semantics/option.hxx @@ -34,9 +34,7 @@ namespace semantics return *type_; } - protected: - friend class graph; - + public: void set_left_node (option_type& n) { @@ -78,9 +76,7 @@ namespace semantics return *expression_; } - protected: - friend class graph; - + public: void set_left_node (option_type& n) { @@ -139,9 +135,7 @@ namespace semantics return initialized_->expression (); } - protected: - friend class graph; - + public: option (path const& file, size_t line, size_t column) : node (file, line, column), initialized_ (0) { diff --git a/cli/semantics/unit.hxx b/cli/semantics/unit.hxx index a67e1ff..d7e6727 100644 --- a/cli/semantics/unit.hxx +++ b/cli/semantics/unit.hxx @@ -36,9 +36,7 @@ namespace semantics return file_; } - protected: - friend class graph; - + public: includes (string const& file) : file_ (file) { @@ -66,9 +64,7 @@ namespace semantics return *includee_; } - protected: - friend class graph; - + public: cli_includes (string const& file) : includes (file) { @@ -95,9 +91,7 @@ namespace semantics return *includee_; } - protected: - friend class graph; - + public: cxx_includes (string const& file) : includes (file) { @@ -117,9 +111,7 @@ namespace semantics // class cxx_unit: public node { - protected: - friend class graph; - + public: cxx_unit (path const& file, size_t line, size_t column) : node (file, line, column) { @@ -156,7 +148,7 @@ namespace semantics public: cli_unit (path const& file) - : node (file, 1, 1) + : node (file, 1, 1), graph_ (*this) { // Use a special edge to get this->name() return the global // namespace name (""). @@ -169,14 +161,14 @@ namespace semantics T& new_node (path const& file, size_t line, size_t column) { - return graph ().new_node (file, line, column); + return graph_.new_node (file, line, column); } template T& new_node (path const& file, size_t line, size_t column, A0 const& a0) { - return graph ().new_node (file, line, column, a0); + return graph_.new_node (file, line, column, a0); } template @@ -184,7 +176,7 @@ namespace semantics new_node (path const& file, size_t line, size_t column, A0 const& a0, A1 const& a1) { - return graph ().new_node (file, line, column, a0, a1); + return graph_.new_node (file, line, column, a0, a1); } template @@ -192,7 +184,7 @@ namespace semantics new_node (path const& file, size_t line, size_t column, A0 const& a0, A1 const& a1, A2 const& a2) { - return graph ().new_node (file, line, column, a0, a1, a2); + return graph_.new_node (file, line, column, a0, a1, a2); } template @@ -200,7 +192,7 @@ namespace semantics new_node (path const& file, size_t line, size_t column, A0 const& a0, A1 const& a1, A2 const& a2, A3 const& a3) { - return graph ().new_node (file, line, column, a0, a1, a2, a3); + return graph_.new_node (file, line, column, a0, a1, a2, a3); } public: @@ -219,9 +211,7 @@ namespace semantics // class global_names: public names { - protected: - friend class graph; - + public: global_names () : names ("") { @@ -252,9 +242,7 @@ namespace semantics } }; - protected: - friend class graph; - + public: void add_edge_left (cli_includes& e) { @@ -280,16 +268,10 @@ namespace semantics using namespace_::add_edge_right; private: - semantics::graph& - graph () - { - return *this; - } - - private: typedef std::map type_map; private: + graph& graph_; includes_list includes_; type_map types_; }; -- cgit v1.1