diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-08-15 11:46:00 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-08-15 11:46:00 +0200 |
commit | eacf52a9a4f3832274fdefc909ab23c13413e128 (patch) | |
tree | f1f754b6149797315f91d6f872363555201d5a65 /odb/diagnostics.cxx | |
parent | 396cad633b6f0559a39e5111827f9b1125c67506 (diff) |
Add support for member accessors/modifiers
New pragmas: get, set, access. New test: common/access.
Diffstat (limited to 'odb/diagnostics.cxx')
-rw-r--r-- | odb/diagnostics.cxx | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/odb/diagnostics.cxx b/odb/diagnostics.cxx index bce1102..0ebfba9 100644 --- a/odb/diagnostics.cxx +++ b/odb/diagnostics.cxx @@ -3,13 +3,17 @@ // license : GNU GPL v3; see accompanying LICENSE file #include <odb/gcc.hxx> + +#include <sstream> + #include <odb/cxx-lexer.hxx> #include <odb/diagnostics.hxx> using namespace std; +using cutl::fs::path; std::ostream& -error (cutl::fs::path const& p, size_t line, size_t clmn) +error (path const& p, size_t line, size_t clmn) { //@@ We only need to do this if we are still parsing (i.e., // pragma parsing). Is there a way to detect this? @@ -21,7 +25,7 @@ error (cutl::fs::path const& p, size_t line, size_t clmn) } std::ostream& -warn (cutl::fs::path const& p, size_t line, size_t clmn) +warn (path const& p, size_t line, size_t clmn) { warningcount++; @@ -30,7 +34,7 @@ warn (cutl::fs::path const& p, size_t line, size_t clmn) } std::ostream& -info (cutl::fs::path const& p, size_t line, size_t clmn) +info (path const& p, size_t line, size_t clmn) { cerr << p << ':' << line << ':' << clmn << ": info: "; return cerr; @@ -86,10 +90,38 @@ info (cxx_lexer& l) return info (l.location ()); } -cutl::fs::path +std::string +location_string (path const& p, size_t line, size_t clmn, bool leaf) +{ + ostringstream ostr; + + if (leaf) + ostr << p.leaf (); + else + ostr << p; + + ostr << ':' << line << ':' << clmn; + return ostr.str (); +} + +std::string +location_string (location_t loc, bool leaf) +{ + ostringstream ostr; + + if (leaf) + ostr << path (LOCATION_FILE (loc)).leaf (); + else + ostr << LOCATION_FILE (loc); + + ostr << ':' << LOCATION_LINE (loc) << ':' << LOCATION_COLUMN (loc); + return ostr.str (); +} + +path location_file (location_t loc) { - return cutl::fs::path (LOCATION_FILE (loc)); + return path (LOCATION_FILE (loc)); } size_t |