diff options
author | Jason Merrill <jason@redhat.com> | 2019-09-27 14:19:55 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-09-27 14:19:55 -0400 |
commit | c872f1506d46ceba10776d0ebc86b4126273a419 (patch) | |
tree | 2a0a2e3ea4616da4030026f5092c505936d412e3 /gcc/cp/cp-tree.h | |
parent | 975d043ff6b6f8a9e9ff0be799701fc1d842bb83 (diff) | |
download | gcc-c872f1506d46ceba10776d0ebc86b4126273a419.zip gcc-c872f1506d46ceba10776d0ebc86b4126273a419.tar.gz gcc-c872f1506d46ceba10776d0ebc86b4126273a419.tar.bz2 |
cp-tree.h (class iloc_sentinel): New.
* cp-tree.h (class iloc_sentinel): New.
We didn't already have a sentinel for input_location, and while
temp_override would work, it would also happily set input_location to 0,
which breaks things that try to look up the associated filename.
* decl.c (grokdeclarator, finish_enum_value_list): Use it.
* mangle.c (mangle_decl_string): Use it.
* pt.c (perform_typedefs_access_check): Use it.
From-SVN: r276191
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r-- | gcc/cp/cp-tree.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 8fc3fc1..be1a44e 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1762,6 +1762,24 @@ public: ~warning_sentinel() { flag = val; } }; +/* RAII sentinel to temporarily override input_location. This will not set + input_location to UNKNOWN_LOCATION or BUILTINS_LOCATION. */ + +class iloc_sentinel +{ + location_t saved_loc; +public: + iloc_sentinel (location_t loc): saved_loc (input_location) + { + if (loc >= RESERVED_LOCATION_COUNT) + input_location = loc; + } + ~iloc_sentinel () + { + input_location = saved_loc; + } +}; + /* RAII sentinel that saves the value of a variable, optionally overrides it right away, and restores its value when the sentinel id destructed. */ |