[PATCH] Make sure !empty() before calling front().
Chaoren Lin
chaorenl at google.com
Sat May 23 01:55:41 PDT 2015
Hi howard.hinnant,
http://reviews.llvm.org/D9954
Files:
src/cxa_demangle.cpp
Index: src/cxa_demangle.cpp
===================================================================
--- src/cxa_demangle.cpp
+++ src/cxa_demangle.cpp
@@ -1671,7 +1671,7 @@
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 @@
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 @@
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 @@
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, ")");
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9954.26368.patch
Type: text/x-patch
Size: 2423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150523/0743707e/attachment.bin>
More information about the cfe-commits
mailing list