From 8b9a887632d4599390ec48d3265ed284eb7a1005 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 22 Sep 2010 20:01:05 +0200 Subject: Handle pragmas for fundamental types and template instantiations Use main type variant as a key in pragma map. --- odb/parser.cxx | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'odb/parser.cxx') diff --git a/odb/parser.cxx b/odb/parser.cxx index f620ed5..ad740c4 100644 --- a/odb/parser.cxx +++ b/odb/parser.cxx @@ -100,8 +100,12 @@ private: emit_type_name (tree, bool direct = true); + // // Pragma handling. // + + // Process positioned and named pragmas. + // void process_pragmas (tree, node&, @@ -110,6 +114,11 @@ private: decl_set::const_iterator cur, decl_set::const_iterator end); + // Process named pragmas only. + // + void + process_named_pragmas (tree, node&); + void diagnose_unassoc_pragmas (decl_set const&); @@ -192,6 +201,8 @@ define_fund (tree t) T& node (unit_->new_fund_node (t)); unit_->new_edge (*scope_, node, name); unit_->insert (t, node); + + process_named_pragmas (t, node); } template @@ -1224,6 +1235,8 @@ emit_type (tree t, // qualifier& q (unit_->new_node (file, line, clmn, t, qc, qv, qr)); unit_->new_edge (q, r); + process_named_pragmas (t, q); + return q; } @@ -1357,6 +1370,7 @@ create_type (tree t, << " at " << file << ":" << line << endl; unit_->new_edge (*i_node, *t_node); + process_named_pragmas (t, *i_node); r = i_node; } @@ -1443,6 +1457,7 @@ create_type (tree t, array& a (unit_->new_node (file, line, clmn, t, size)); unit_->insert (t, a); unit_->new_edge (a, bt); + process_named_pragmas (t, a); r = &a; break; } @@ -1453,6 +1468,7 @@ create_type (tree t, reference& ref (unit_->new_node (file, line, clmn, t)); unit_->insert (t, ref); unit_->new_edge (ref, bt); + process_named_pragmas (t, ref); r = &ref; break; } @@ -1465,6 +1481,7 @@ create_type (tree t, pointer& p (unit_->new_node (file, line, clmn, t)); unit_->insert (t, p); unit_->new_edge (p, bt); + process_named_pragmas (t, p); r = &p; } else @@ -1746,6 +1763,28 @@ process_pragmas (tree t, } void parser::impl:: +process_named_pragmas (tree t, node& node) +{ + pragma_set prags; + + decl_pragmas::const_iterator i (decl_pragmas_.find (t)); + + if (i != decl_pragmas_.end ()) + prags.insert (i->second.begin (), i->second.end ()); + + // Copy the resulting pragma set to context. + // + for (pragma_set::iterator i (prags.begin ()); i != prags.end (); ++i) + { + if (trace) + ts << "\t\t pragma " << i->name << " (" << i->value << ")" + << endl; + + node.set (i->name, i->value); + } +} + +void parser::impl:: diagnose_unassoc_pragmas (decl_set const& decls) { for (decl_set::const_iterator i (decls.begin ()), e (decls.end ()); -- cgit v1.1