comparison libiberty/cp-demangle.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Internal demangler interface for g++ V3 ABI. 1 /* Internal demangler interface for g++ V3 ABI.
2 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010 2 Copyright (C) 2003-2017 Free Software Foundation, Inc.
3 Free Software Foundation, Inc.
4 Written by Ian Lance Taylor <ian@wasabisystems.com>. 3 Written by Ian Lance Taylor <ian@wasabisystems.com>.
5 4
6 This file is part of the libiberty library, which is part of GCC. 5 This file is part of the libiberty library, which is part of GCC.
7 6
8 This file is free software; you can redistribute it and/or modify 7 This file is free software; you can redistribute it and/or modify
110 struct demangle_component **subs; 109 struct demangle_component **subs;
111 /* The index of the next substitution. */ 110 /* The index of the next substitution. */
112 int next_sub; 111 int next_sub;
113 /* The number of available entries in the subs array. */ 112 /* The number of available entries in the subs array. */
114 int num_subs; 113 int num_subs;
115 /* The number of substitutions which we actually made from the subs
116 array, plus the number of template parameter references we
117 saw. */
118 int did_subs;
119 /* The last name we saw, for constructors and destructors. */ 114 /* The last name we saw, for constructors and destructors. */
120 struct demangle_component *last_name; 115 struct demangle_component *last_name;
121 /* A running total of the length of large expansions from the 116 /* A running total of the length of large expansions from the
122 mangled name to the demangled name, such as standard 117 mangled name to the demangled name, such as standard
123 substitutions and builtin types. */ 118 substitutions and builtin types. */
124 int expansion; 119 int expansion;
120 /* Non-zero if we are parsing an expression. */
121 int is_expression;
122 /* Non-zero if we are parsing the type operand of a conversion
123 operator, but not when in an expression. */
124 int is_conversion;
125 }; 125 };
126 126
127 /* To avoid running past the ending '\0', don't: 127 /* To avoid running past the ending '\0', don't:
128 - call d_peek_next_char if d_peek_char returned '\0' 128 - call d_peek_next_char if d_peek_char returned '\0'
129 - call d_advance with an 'i' that is too large 129 - call d_advance with an 'i' that is too large
130 - call d_check_char(di, '\0') 130 - call d_check_char(di, '\0')
131 Everything else is safe. */ 131 Everything else is safe. */
132 #define d_peek_char(di) (*((di)->n)) 132 #define d_peek_char(di) (*((di)->n))
133 #define d_peek_next_char(di) ((di)->n[1]) 133 #ifndef CHECK_DEMANGLER
134 #define d_advance(di, i) ((di)->n += (i)) 134 # define d_peek_next_char(di) ((di)->n[1])
135 # define d_advance(di, i) ((di)->n += (i))
136 #endif
135 #define d_check_char(di, c) (d_peek_char(di) == c ? ((di)->n++, 1) : 0) 137 #define d_check_char(di, c) (d_peek_char(di) == c ? ((di)->n++, 1) : 0)
136 #define d_next_char(di) (d_peek_char(di) == '\0' ? '\0' : *((di)->n++)) 138 #define d_next_char(di) (d_peek_char(di) == '\0' ? '\0' : *((di)->n++))
137 #define d_str(di) ((di)->n) 139 #define d_str(di) ((di)->n)
140
141 #ifdef CHECK_DEMANGLER
142 static inline char
143 d_peek_next_char (const struct d_info *di)
144 {
145 if (!di->n[0])
146 abort ();
147 return di->n[1];
148 }
149
150 static inline void
151 d_advance (struct d_info *di, int i)
152 {
153 if (i < 0)
154 abort ();
155 while (i--)
156 {
157 if (!di->n[0])
158 abort ();
159 di->n++;
160 }
161 }
162 #endif
138 163
139 /* Functions and arrays in cp-demangle.c which are referenced by 164 /* Functions and arrays in cp-demangle.c which are referenced by
140 functions in cp-demint.c. */ 165 functions in cp-demint.c. */
141 #ifdef IN_GLIBCPP_V3 166 #ifdef IN_GLIBCPP_V3
142 #define CP_STATIC_IF_GLIBCPP_V3 static 167 #define CP_STATIC_IF_GLIBCPP_V3 static