diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Demangle/ItaniumDemangle.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/llvm/lib/Demangle/ItaniumDemangle.cpp b/llvm/lib/Demangle/ItaniumDemangle.cpp index c7a151bd27f..9f808d6cb6d 100644 --- a/llvm/lib/Demangle/ItaniumDemangle.cpp +++ b/llvm/lib/Demangle/ItaniumDemangle.cpp @@ -36,6 +36,12 @@ enum { success }; +enum { + CV_const = (1 << 0), + CV_volatile = (1 << 1), + CV_restrict = (1 << 2), +}; + template <class C> static const char *parse_type(const char *first, const char *last, C &db); template <class C> @@ -436,15 +442,15 @@ static const char *parse_cv_qualifiers(const char *first, const char *last, cv = 0; if (first != last) { if (*first == 'r') { - cv |= 4; + cv |= CV_restrict; ++first; } if (*first == 'V') { - cv |= 2; + cv |= CV_volatile; ++first; } if (*first == 'K') { - cv |= 1; + cv |= CV_const; ++first; } } @@ -1668,22 +1674,22 @@ static const char *parse_type(const char *first, const char *last, C &db) { p -= 2; else if (db.names[k].second.back() == '&') p -= 1; - if (cv & 1) { + if (cv & CV_const) { db.names[k].second.insert(p, " const"); p += 6; } - if (cv & 2) { + if (cv & CV_volatile) { db.names[k].second.insert(p, " volatile"); p += 9; } - if (cv & 4) + if (cv & CV_restrict) db.names[k].second.insert(p, " restrict"); } else { - if (cv & 1) + if (cv & CV_const) db.names[k].first.append(" const"); - if (cv & 2) + if (cv & CV_volatile) db.names[k].first.append(" volatile"); - if (cv & 4) + if (cv & CV_restrict) db.names[k].first.append(" restrict"); } db.subs.back().push_back(db.names[k]); @@ -4074,11 +4080,11 @@ static const char *parse_encoding(const char *first, const char *last, C &db) { if (db.names.empty()) return first; db.names.back().first += ')'; - if (cv & 1) + if (cv & CV_const) db.names.back().first.append(" const"); - if (cv & 2) + if (cv & CV_volatile) db.names.back().first.append(" volatile"); - if (cv & 4) + if (cv & CV_restrict) db.names.back().first.append(" restrict"); if (ref == 1) db.names.back().first.append(" &"); |

