From 09b056975dacd1f0f815ad820b6dc9913b0118a3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 23 Jun 2020 18:55:43 -0400 Subject: fix pointer style to match the style guide We do this in a lot of places, but we're inconsistent. Normalize the code to the Google C++ style guide. Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932 Reviewed-by: Sterling Augustine Reviewed-by: Mark Mentovai --- src/common/module.h | 60 ++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 31 deletions(-) (limited to 'src/common/module.h') diff --git a/src/common/module.h b/src/common/module.h index 7309cedd..60bf709b 100644 --- a/src/common/module.h +++ b/src/common/module.h @@ -74,7 +74,7 @@ class Module { // A source file. struct File { - explicit File(const string &name_input) : name(name_input), source_id(0) {} + explicit File(const string& name_input) : name(name_input), source_id(0) {} // The name of the source file. const string name; @@ -96,12 +96,12 @@ class Module { // A function. struct Function { - Function(const string &name_input, const Address &address_input) : + Function(const string& name_input, const Address& address_input) : name(name_input), address(address_input), parameter_size(0) {} // For sorting by address. (Not style-guide compliant, but it's // stupid not to put this in the struct.) - static bool CompareByAddress(const Function *x, const Function *y) { + static bool CompareByAddress(const Function* x, const Function* y) { return x->address < y->address; } @@ -124,18 +124,18 @@ class Module { struct Line { // For sorting by address. (Not style-guide compliant, but it's // stupid not to put this in the struct.) - static bool CompareByAddress(const Module::Line &x, const Module::Line &y) { + static bool CompareByAddress(const Module::Line& x, const Module::Line& y) { return x.address < y.address; } Address address, size; // The address and size of the line's code. - File *file; // The source file. + File* file; // The source file. int number; // The source line number. }; // An exported symbol. struct Extern { - explicit Extern(const Address &address_input) : address(address_input) {} + explicit Extern(const Address& address_input) : address(address_input) {} const Address address; string name; }; @@ -170,8 +170,7 @@ class Module { }; struct FunctionCompare { - bool operator() (const Function *lhs, - const Function *rhs) const { + bool operator() (const Function* lhs, const Function* rhs) const { if (lhs->address == rhs->address) return lhs->name < rhs->name; return lhs->address < rhs->address; @@ -179,16 +178,15 @@ class Module { }; struct ExternCompare { - bool operator() (const Extern *lhs, - const Extern *rhs) const { + bool operator() (const Extern* lhs, const Extern* rhs) const { return lhs->address < rhs->address; } }; // Create a new module with the given name, operating system, // architecture, and ID string. - Module(const string &name, const string &os, const string &architecture, - const string &id, const string &code_id = ""); + Module(const string& name, const string& os, const string& architecture, + const string& id, const string& code_id = ""); ~Module(); // Set the module's load address to LOAD_ADDRESS; addresses given @@ -216,62 +214,62 @@ class Module { // Add FUNCTION to the module. FUNCTION's name must not be empty. // This module owns all Function objects added with this function: // destroying the module destroys them as well. - void AddFunction(Function *function); + void AddFunction(Function* function); // Add all the functions in [BEGIN,END) to the module. // This module owns all Function objects added with this function: // destroying the module destroys them as well. - void AddFunctions(vector::iterator begin, - vector::iterator end); + void AddFunctions(vector::iterator begin, + vector::iterator end); // Add STACK_FRAME_ENTRY to the module. // This module owns all StackFrameEntry objects added with this // function: destroying the module destroys them as well. - void AddStackFrameEntry(StackFrameEntry *stack_frame_entry); + void AddStackFrameEntry(StackFrameEntry* stack_frame_entry); // Add PUBLIC to the module. // This module owns all Extern objects added with this function: // destroying the module destroys them as well. - void AddExtern(Extern *ext); + void AddExtern(Extern* ext); // If this module has a file named NAME, return a pointer to it. If // it has none, then create one and return a pointer to the new // file. This module owns all File objects created using these // functions; destroying the module destroys them as well. - File *FindFile(const string &name); - File *FindFile(const char *name); + File* FindFile(const string& name); + File* FindFile(const char* name); // If this module has a file named NAME, return a pointer to it. // Otherwise, return NULL. - File *FindExistingFile(const string &name); + File* FindExistingFile(const string& name); // Insert pointers to the functions added to this module at I in // VEC. The pointed-to Functions are still owned by this module. // (Since this is effectively a copy of the function list, this is // mostly useful for testing; other uses should probably get a more // appropriate interface.) - void GetFunctions(vector *vec, vector::iterator i); + void GetFunctions(vector* vec, vector::iterator i); // Insert pointers to the externs added to this module at I in // VEC. The pointed-to Externs are still owned by this module. // (Since this is effectively a copy of the extern list, this is // mostly useful for testing; other uses should probably get a more // appropriate interface.) - void GetExterns(vector *vec, vector::iterator i); + void GetExterns(vector* vec, vector::iterator i); // Clear VEC and fill it with pointers to the Files added to this // module, sorted by name. The pointed-to Files are still owned by // this module. (Since this is effectively a copy of the file list, // this is mostly useful for testing; other uses should probably get // a more appropriate interface.) - void GetFiles(vector *vec); + void GetFiles(vector* vec); // Clear VEC and fill it with pointers to the StackFrameEntry // objects that have been added to this module. (Since this is // effectively a copy of the stack frame entry list, this is mostly // useful for testing; other uses should probably get // a more appropriate interface.) - void GetStackFrameEntries(vector *vec) const; + void GetStackFrameEntries(vector* vec) const; // Find those files in this module that are actually referred to by // functions' line number data, and assign them source id numbers. @@ -292,7 +290,7 @@ class Module { // - all CFI records. // Addresses in the output are all relative to the load address // established by SetLoadAddress. - bool Write(std::ostream &stream, SymbolData symbol_data); + bool Write(std::ostream& stream, SymbolData symbol_data); string name() const { return name_; } string os() const { return os_; } @@ -308,7 +306,7 @@ class Module { // Write RULE_MAP to STREAM, in the form appropriate for 'STACK CFI' // records, without a final newline. Return true if all goes well; // if an error occurs, return false, and leave errno set. - static bool WriteRuleMap(const RuleMap &rule_map, std::ostream &stream); + static bool WriteRuleMap(const RuleMap& rule_map, std::ostream& stream); // Returns true of the specified address resides with an specified address // range, or if no ranges have been specified. @@ -329,18 +327,18 @@ class Module { // Relation for maps whose keys are strings shared with some other // structure. struct CompareStringPtrs { - bool operator()(const string *x, const string *y) const { return *x < *y; } + bool operator()(const string* x, const string* y) const { return *x < *y; } }; // A map from filenames to File structures. The map's keys are // pointers to the Files' names. - typedef map FileByNameMap; + typedef map FileByNameMap; // A set containing Function structures, sorted by address. - typedef set FunctionSet; + typedef set FunctionSet; // A set containing Extern structures, sorted by address. - typedef set ExternSet; + typedef set ExternSet; // The module owns all the files and functions that have been added // to it; destroying the module frees the Files and Functions these @@ -350,7 +348,7 @@ class Module { // The module owns all the call frame info entries that have been // added to it. - vector stack_frame_entries_; + vector stack_frame_entries_; // The module owns all the externs that have been added to it; // destroying the module frees the Externs these point to. -- cgit v1.2.1