aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-07-21 15:23:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-07-22 17:56:59 +0200
commit5cf8ecfc25d56e733e2c803942f1bee0378e6639 (patch)
treebac693fb7ef803576d22b4abc67e3e193efa8a40
parent0d61aca198f1a5a71a791b892ef55fe2947d7aa0 (diff)
Add support for optional tree node value in pragmas
-rw-r--r--odb/parser.cxx8
-rw-r--r--odb/pragma.cxx5
-rw-r--r--odb/pragma.hxx5
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;
};