[libcxxabi] r238263 - Make sure !empty() before calling String::front().
Chaoren Lin
chaorenl at google.com
Tue May 26 16:14:27 PDT 2015
Author: chaoren
Date: Tue May 26 18:14:26 2015
New Revision: 238263
URL: http://llvm.org/viewvc/llvm-project?rev=238263&view=rev
Log:
Make sure !empty() before calling String::front().
Reviewers: howard.hinnant
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D9954
Modified:
libcxxabi/trunk/src/cxa_demangle.cpp
Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=238263&r1=238262&r2=238263&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Tue May 26 18:14:26 2015
@@ -1671,7 +1671,7 @@ parse_pointer_to_member_type(const char*
auto func = std::move(db.names.back());
db.names.pop_back();
auto class_type = std::move(db.names.back());
- if (func.second.front() == '(')
+ if (!func.second.empty() && func.second.front() == '(')
{
db.names.back().first = std::move(func.first) + "(" + class_type.move_full() + "::*";
db.names.back().second = ")" + std::move(func.second);
@@ -2018,7 +2018,8 @@ parse_type(const char* first, const char
db.names[k].first += " (";
db.names[k].second.insert(0, ")");
}
- else if (db.names[k].second.front() == '(')
+ else if (!db.names[k].second.empty() &&
+ db.names[k].second.front() == '(')
{
db.names[k].first += "(";
db.names[k].second.insert(0, ")");
@@ -2045,7 +2046,8 @@ parse_type(const char* first, const char
db.names[k].first += " (";
db.names[k].second.insert(0, ")");
}
- else if (db.names[k].second.front() == '(')
+ else if (!db.names[k].second.empty() &&
+ db.names[k].second.front() == '(')
{
db.names[k].first += "(";
db.names[k].second.insert(0, ")");
@@ -2079,7 +2081,8 @@ parse_type(const char* first, const char
db.names[k].first += " (";
db.names[k].second.insert(0, ")");
}
- else if (db.names[k].second.front() == '(')
+ else if (!db.names[k].second.empty() &&
+ db.names[k].second.front() == '(')
{
db.names[k].first += "(";
db.names[k].second.insert(0, ")");
More information about the cfe-commits
mailing list