Fix building unittests failure caused by the introduction of StringView at https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3189410

Change-Id: I258863e5de6201bc24b53dbe50b4d2515d29e338
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3221513
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Zequan Wu 2021-10-14 10:39:55 -07:00 committed by Joshua Peraza
parent db97ea1fd0
commit 6b66d136ca
3 changed files with 7 additions and 5 deletions

View file

@ -193,7 +193,8 @@ TEST(Write, OmitUnusedFiles) {
function->lines.push_back(line2); function->lines.push_back(line2);
m.AddFunction(function); m.AddFunction(function);
m.AssignSourceIds(); std::set<Module::InlineOrigin*, Module::InlineOriginCompare> inline_origins;
m.AssignSourceIds(inline_origins);
vector<Module::File*> vec; vector<Module::File*> vec;
m.GetFiles(&vec); m.GetFiles(&vec);

View file

@ -62,7 +62,7 @@ TEST(StabsToModule, SimpleCU) {
m.GetFunctions(&functions, functions.end()); m.GetFunctions(&functions, functions.end());
ASSERT_EQ((size_t) 1, functions.size()); ASSERT_EQ((size_t) 1, functions.size());
Module::Function *function = functions[0]; Module::Function *function = functions[0];
EXPECT_STREQ("function", function->name.c_str()); EXPECT_STREQ("function", function->name.str().c_str());
EXPECT_EQ(0xfde4abbed390c394LL, function->address); EXPECT_EQ(0xfde4abbed390c394LL, function->address);
EXPECT_EQ(0x10U, function->ranges[0].size); EXPECT_EQ(0x10U, function->ranges[0].size);
EXPECT_EQ(0U, function->parameter_size); EXPECT_EQ(0U, function->parameter_size);
@ -164,7 +164,7 @@ TEST(InferSizes, LineSize) {
ASSERT_EQ((size_t) 1, functions.size()); ASSERT_EQ((size_t) 1, functions.size());
Module::Function *function = functions[0]; Module::Function *function = functions[0];
EXPECT_STREQ("function", function->name.c_str()); EXPECT_STREQ("function", function->name.str().c_str());
EXPECT_EQ(0xb4513962eff94e92LL, function->address); EXPECT_EQ(0xb4513962eff94e92LL, function->address);
EXPECT_EQ(0x1000100000000ULL, function->ranges[0].size); // inferred from CU end EXPECT_EQ(0x1000100000000ULL, function->ranges[0].size); // inferred from CU end
EXPECT_EQ(0U, function->parameter_size); EXPECT_EQ(0U, function->parameter_size);
@ -214,7 +214,7 @@ TEST(FunctionNames, Mangled) {
EXPECT_STREQ("std::vector<unsigned long long, " EXPECT_STREQ("std::vector<unsigned long long, "
"std::allocator<unsigned long long> >::" "std::allocator<unsigned long long> >::"
"push_back(unsigned long long const&)", "push_back(unsigned long long const&)",
function->name.c_str()); function->name.str().c_str());
EXPECT_EQ(0xf2cfda63cef7f46dLL, function->address); EXPECT_EQ(0xf2cfda63cef7f46dLL, function->address);
EXPECT_LT(0U, function->ranges[0].size); // should have used dummy size EXPECT_LT(0U, function->ranges[0].size); // should have used dummy size
EXPECT_EQ(0U, function->parameter_size); EXPECT_EQ(0U, function->parameter_size);

View file

@ -38,7 +38,8 @@
namespace google_breakpad { namespace google_breakpad {
// A StringView is a string reference to a string object, but not own the // A StringView is a string reference to a string object, but not own the
// string object. // string object. It's a compatibile layer until we can use std::string_view in
// C++17.
class StringView { class StringView {
private: private:
// The start of the string, in an external buffer. It doesn't have to be // The start of the string, in an external buffer. It doesn't have to be