Merge "Add support for non-virtual thunk."
am: 0d323c12df
Change-Id: I03c398b7d7df3b1dedf46447c57de896b28dc302
This commit is contained in:
commit
a302ae3b6e
2 changed files with 46 additions and 1 deletions
|
|
@ -488,6 +488,27 @@ TEST(DemangleTest, BooleanLiterals) {
|
|||
demangler.Parse("_ZN3oneE3twoI5threeI4fourELb0ELb1EE"));
|
||||
}
|
||||
|
||||
TEST(DemangleTest, non_virtual_thunk) {
|
||||
Demangler demangler;
|
||||
|
||||
ASSERT_EQ("non-virtual thunk to one", demangler.Parse("_ZThn0_N3oneE"));
|
||||
ASSERT_EQ("non-virtual thunk to two", demangler.Parse("_ZThn0_3two"));
|
||||
ASSERT_EQ("non-virtual thunk to three", demangler.Parse("_ZTh0_5three"));
|
||||
ASSERT_EQ("non-virtual thunk to four", demangler.Parse("_ZTh_4four"));
|
||||
ASSERT_EQ("non-virtual thunk to five", demangler.Parse("_ZTh0123456789_4five"));
|
||||
ASSERT_EQ("non-virtual thunk to six", demangler.Parse("_ZThn0123456789_3six"));
|
||||
|
||||
ASSERT_EQ("_ZThn0N3oneE", demangler.Parse("_ZThn0N3oneE"));
|
||||
ASSERT_EQ("_ZThn03two", demangler.Parse("_ZThn03two"));
|
||||
ASSERT_EQ("_ZTh05three", demangler.Parse("_ZTh05three"));
|
||||
ASSERT_EQ("_ZTh4four", demangler.Parse("_ZTh4four"));
|
||||
ASSERT_EQ("_ZTh01234567894five", demangler.Parse("_ZTh01234567894five"));
|
||||
ASSERT_EQ("_ZThn01234567893six", demangler.Parse("_ZThn01234567893six"));
|
||||
ASSERT_EQ("_ZT_N3oneE", demangler.Parse("_ZT_N3oneE"));
|
||||
ASSERT_EQ("_ZT0_N3oneE", demangler.Parse("_ZT0_N3oneE"));
|
||||
ASSERT_EQ("_ZTH_N3oneE", demangler.Parse("_ZTH_N3oneE"));
|
||||
}
|
||||
|
||||
TEST(DemangleTest, demangle) {
|
||||
std::string str;
|
||||
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ const char* Demangler::ParseFunctionName(const char* name) {
|
|||
saves_.pop_back();
|
||||
}
|
||||
|
||||
function_name_ = cur_state_.str;
|
||||
function_name_ += cur_state_.str;
|
||||
while (!cur_state_.suffixes.empty()) {
|
||||
function_suffix_ += cur_state_.suffixes.back();
|
||||
cur_state_.suffixes.pop_back();
|
||||
|
|
@ -786,6 +786,30 @@ const char* Demangler::ParseFunctionTemplateArguments(const char* name) {
|
|||
}
|
||||
|
||||
const char* Demangler::FindFunctionName(const char* name) {
|
||||
if (*name == 'T') {
|
||||
// non-virtual thunk, verify that it matches one of these patterns:
|
||||
// Thn[0-9]+_
|
||||
// Th[0-9]+_
|
||||
// Thn_
|
||||
// Th_
|
||||
name++;
|
||||
if (*name != 'h') {
|
||||
return nullptr;
|
||||
}
|
||||
name++;
|
||||
if (*name == 'n') {
|
||||
name++;
|
||||
}
|
||||
while (std::isdigit(*name)) {
|
||||
name++;
|
||||
}
|
||||
if (*name != '_') {
|
||||
return nullptr;
|
||||
}
|
||||
function_name_ = "non-virtual thunk to ";
|
||||
return name + 1;
|
||||
}
|
||||
|
||||
if (*name == 'N') {
|
||||
parse_funcs_.push_back(&Demangler::ParseArgumentsAtTopLevel);
|
||||
parse_func_ = &Demangler::ParseFunctionName;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue