From 5cf8ecfc25d56e733e2c803942f1bee0378e6639 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 21 Jul 2011 15:23:19 +0200 Subject: Add support for optional tree node value in pragmas --- odb/parser.cxx | 8 ++++++++ odb/pragma.cxx | 5 +++-- odb/pragma.hxx | 5 +++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/odb/parser.cxx b/odb/parser.cxx index fda4579..16612df 100644 --- a/odb/parser.cxx +++ b/odb/parser.cxx @@ -1886,6 +1886,10 @@ process_pragmas (tree t, tmp[j] = '-'; node.set (tmp, i->value); + + if (i->node != 0) + node.set (tmp + "-node", i->node); + node.set (tmp + "-loc", i->loc); } } @@ -1917,6 +1921,10 @@ process_named_pragmas (tree t, node& node) tmp[j] = '-'; node.set (tmp, i->value); + + if (i->node != 0) + node.set (tmp + "-node", i->node); + node.set (tmp + "-loc", i->loc); } } diff --git a/odb/pragma.cxx b/odb/pragma.cxx index 6fea208..bf1b1d1 100644 --- a/odb/pragma.cxx +++ b/odb/pragma.cxx @@ -259,6 +259,7 @@ handle_pragma (cpp_reader* reader, cpp_ttype tt; string val; + tree node (0); location_t loc (input_location); if (p == "table") @@ -663,7 +664,7 @@ handle_pragma (cpp_reader* reader, // Record this pragma. // - pragma prag (p, val, loc); + pragma prag (p, val, node, loc); if (decl) decl_pragmas_[decl].insert (prag); @@ -857,7 +858,7 @@ handle_pragma_qualifier (cpp_reader* reader, string const& p) // Record this pragma. // - pragma prag (p, "", loc); + pragma prag (p, "", 0, loc); if (decl) decl_pragmas_[decl].insert (prag); diff --git a/odb/pragma.hxx b/odb/pragma.hxx index f5714eb..d8c4ab5 100644 --- a/odb/pragma.hxx +++ b/odb/pragma.hxx @@ -15,8 +15,8 @@ struct pragma { - pragma (std::string const& n, std::string const& v, location_t l) - : name (n), value (v), loc (l) + pragma (std::string const& n, std::string const& v, tree tn, location_t l) + : name (n), value (v), node (tn), loc (l) { } @@ -28,6 +28,7 @@ struct pragma std::string name; std::string value; + tree node; location_t loc; }; -- cgit v1.1