From 2f6cb866d615d6240a18c7535c994c6bb93b1ba5 Mon Sep 17 00:00:00 2001 From: Ivan Penkov Date: Mon, 7 Nov 2016 19:37:19 -0500 Subject: [PATCH] Allow compiling the google-breakpad code using a global ::string class instead of std::string. For more details take a look at common/using_std_string.h BUG= Change-Id: Ifebfc57f691ef3a3bef8cfed7106c567985edffc Reviewed-on: https://chromium-review.googlesource.com/399738 Reviewed-by: Mark Mentovai --- src/common/dwarf/elf_reader.h | 2 +- src/common/dwarf_cfi_to_module.cc | 2 +- src/common/dwarf_cfi_to_module.h | 4 ++-- src/common/dwarf_cu_to_module.cc | 2 +- src/common/language.cc | 4 ++-- src/common/language.h | 2 +- src/common/linux/file_id.h | 7 ++++--- src/google_breakpad/processor/proc_maps_linux.h | 2 +- src/processor/stackwalker_unittest_utils.h | 2 +- src/processor/symbolic_constants_win.cc | 1 - src/processor/symbolic_constants_win.h | 3 ++- 11 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/common/dwarf/elf_reader.h b/src/common/dwarf/elf_reader.h index 07477341..b1bb67a8 100644 --- a/src/common/dwarf/elf_reader.h +++ b/src/common/dwarf/elf_reader.h @@ -19,8 +19,8 @@ #include #include "common/dwarf/types.h" +#include "common/using_std_string.h" -using std::string; using std::vector; using std::pair; diff --git a/src/common/dwarf_cfi_to_module.cc b/src/common/dwarf_cfi_to_module.cc index 1bf1d96d..bd298a2f 100644 --- a/src/common/dwarf_cfi_to_module.cc +++ b/src/common/dwarf_cfi_to_module.cc @@ -195,7 +195,7 @@ void DwarfCFIToModule::Record(Module::Address address, int reg, // Place the name in our global set of strings, and then use the string // from the set. Even though the assignment looks like a copy, all the - // major std::string implementations use reference counting internally, + // major string implementations use reference counting internally, // so the effect is to have all our data structures share copies of rules // whenever possible. Since register names are drawn from a // vector, register names are already shared. diff --git a/src/common/dwarf_cfi_to_module.h b/src/common/dwarf_cfi_to_module.h index 084b8f5a..a5302e15 100644 --- a/src/common/dwarf_cfi_to_module.h +++ b/src/common/dwarf_cfi_to_module.h @@ -181,7 +181,7 @@ class DwarfCFIToModule: public CallFrameInfo::Handler { // The names of the return address and canonical frame address. Putting // these here instead of using string literals allows us to share their - // texts in reference-counted std::string implementations (all the + // texts in reference-counted string implementations (all the // popular ones). Many, many rules cite these strings. string cfa_name_, ra_name_; @@ -189,7 +189,7 @@ class DwarfCFIToModule: public CallFrameInfo::Handler { // our data structures, insert it into this set, and then use the string // from the set. // - // Because std::string uses reference counting internally, simply using + // Because string uses reference counting internally, simply using // strings from this set, even if passed by value, assigned, or held // directly in structures and containers (map, for example), // causes those strings to share a single instance of each distinct piece diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc index 8d874366..a16bee7d 100644 --- a/src/common/dwarf_cu_to_module.cc +++ b/src/common/dwarf_cu_to_module.cc @@ -261,7 +261,7 @@ class DwarfCUToModule::GenericDIEHandler: public dwarf2reader::DIEHandler { uint64 offset_; // Place the name in the global set of strings. Even though this looks - // like a copy, all the major std::string implementations use reference + // like a copy, all the major string implementations use reference // counting internally, so the effect is to have all the data structures // share copies of strings whenever possible. // FIXME: Should this return something like a string_ref to avoid the diff --git a/src/common/language.cc b/src/common/language.cc index 09eaceb6..3929c0c6 100644 --- a/src/common/language.cc +++ b/src/common/language.cc @@ -73,7 +73,7 @@ class CPPLanguage: public Language { } virtual DemangleResult DemangleName(const string& mangled, - std::string* demangled) const { + string* demangled) const { #if defined(__ANDROID__) // Android NDK doesn't provide abi::__cxa_demangle. demangled->clear(); @@ -127,7 +127,7 @@ class SwiftLanguage: public Language { } virtual DemangleResult DemangleName(const string& mangled, - std::string* demangled) const { + string* demangled) const { // There is no programmatic interface to a Swift demangler. Pass through the // mangled form because it encodes more information than the qualified name // that would have been built by MakeQualifiedName(). The output can be diff --git a/src/common/language.h b/src/common/language.h index 4ebea1ab..2d2dbcd9 100644 --- a/src/common/language.h +++ b/src/common/language.h @@ -87,7 +87,7 @@ class Language { // Wraps abi::__cxa_demangle() or similar for languages where appropriate. virtual DemangleResult DemangleName(const string& mangled, - std::string* demangled) const { + string* demangled) const { demangled->clear(); return kDontDemangle; } diff --git a/src/common/linux/file_id.h b/src/common/linux/file_id.h index a1d2fd6e..8ccbadd2 100644 --- a/src/common/linux/file_id.h +++ b/src/common/linux/file_id.h @@ -38,6 +38,7 @@ #include "common/linux/guid_creator.h" #include "common/memory.h" +#include "common/using_std_string.h" namespace google_breakpad { @@ -70,16 +71,16 @@ class FileID { // Convert the |identifier| data to a string. The string will // be formatted as a UUID in all uppercase without dashes. // (e.g., 22F065BBFC9C49F780FE26A7CEBD7BCE). - static std::string ConvertIdentifierToUUIDString( + static string ConvertIdentifierToUUIDString( const wasteful_vector& identifier); // Convert the entire |identifier| data to a hex string. - static std::string ConvertIdentifierToString( + static string ConvertIdentifierToString( const wasteful_vector& identifier); private: // Storage for the path specified - std::string path_; + string path_; }; } // namespace google_breakpad diff --git a/src/google_breakpad/processor/proc_maps_linux.h b/src/google_breakpad/processor/proc_maps_linux.h index b8e6eb92..3045daa5 100644 --- a/src/google_breakpad/processor/proc_maps_linux.h +++ b/src/google_breakpad/processor/proc_maps_linux.h @@ -52,7 +52,7 @@ struct MappedMemoryRegion { // Parses /proc//maps input data and stores in |regions|. Returns true // and updates |regions| if and only if all of |input| was successfully parsed. -bool ParseProcMaps(const std::string& input, +bool ParseProcMaps(const string& input, std::vector* regions); } // namespace google_breakpad diff --git a/src/processor/stackwalker_unittest_utils.h b/src/processor/stackwalker_unittest_utils.h index ee22a8fe..1523b247 100644 --- a/src/processor/stackwalker_unittest_utils.h +++ b/src/processor/stackwalker_unittest_utils.h @@ -197,7 +197,7 @@ class MockSymbolSupplier: public google_breakpad::SymbolSupplier { // Copies the passed string contents into a newly allocated buffer. // The newly allocated buffer will be freed during destruction. - char* CopySymbolDataAndOwnTheCopy(const std::string &info, + char* CopySymbolDataAndOwnTheCopy(const string &info, size_t *symbol_data_size) { *symbol_data_size = info.size() + 1; char *symbol_data = new char[*symbol_data_size]; diff --git a/src/processor/symbolic_constants_win.cc b/src/processor/symbolic_constants_win.cc index a6ee26a2..8cf283f6 100644 --- a/src/processor/symbolic_constants_win.cc +++ b/src/processor/symbolic_constants_win.cc @@ -36,7 +36,6 @@ #include #include "common/stdio_wrapper.h" -#include "common/using_std_string.h" #include "google_breakpad/common/breakpad_types.h" #include "google_breakpad/common/minidump_exception_win32.h" #include "processor/symbolic_constants_win.h" diff --git a/src/processor/symbolic_constants_win.h b/src/processor/symbolic_constants_win.h index c05c9169..3f4d38eb 100644 --- a/src/processor/symbolic_constants_win.h +++ b/src/processor/symbolic_constants_win.h @@ -38,12 +38,13 @@ #include +#include "common/using_std_string.h" #include "google_breakpad/common/breakpad_types.h" namespace google_breakpad { /* Converts a NTSTATUS code to a reason string. */ -std::string NTStatusToString(uint32_t ntstatus); +string NTStatusToString(uint32_t ntstatus); } // namespace google_breakpad