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 <mark@chromium.org>
This commit is contained in:
Ivan Penkov 2016-11-07 19:37:19 -05:00
parent 1f574b52c6
commit 2f6cb866d6
11 changed files with 16 additions and 15 deletions

View File

@ -19,8 +19,8 @@
#include <vector>
#include "common/dwarf/types.h"
#include "common/using_std_string.h"
using std::string;
using std::vector;
using std::pair;

View File

@ -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<string>, register names are already shared.

View File

@ -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<string, ...>, for example),
// causes those strings to share a single instance of each distinct piece

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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<uint8_t>& identifier);
// Convert the entire |identifier| data to a hex string.
static std::string ConvertIdentifierToString(
static string ConvertIdentifierToString(
const wasteful_vector<uint8_t>& identifier);
private:
// Storage for the path specified
std::string path_;
string path_;
};
} // namespace google_breakpad

View File

@ -52,7 +52,7 @@ struct MappedMemoryRegion {
// Parses /proc/<pid>/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<MappedMemoryRegion>* regions);
} // namespace google_breakpad

View File

@ -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];

View File

@ -36,7 +36,6 @@
#include <string>
#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"

View File

@ -38,12 +38,13 @@
#include <string>
#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