Remove "using namespace std" from dwarf2reader.h. Using-directives are
forbidden by the style guide, and are bad practice in headers even under style rules that tolerate this construct. This fixes warnings such as: In file included from dwarf2reader.cc:34: dwarf2reader.h:53:17: warning: using namespace directive in global context in header [-Wheader-hygiene] Review URL: http://breakpad.appspot.com/312002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@862 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
29b0d713c9
commit
bc582f782b
5 changed files with 41 additions and 40 deletions
|
@ -176,7 +176,7 @@ void DIEDispatcher::ProcessAttributeBuffer(uint64 offset,
|
|||
void DIEDispatcher::ProcessAttributeString(uint64 offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const string& data) {
|
||||
const std::string& data) {
|
||||
HandlerStack ¤t = die_handlers_.top();
|
||||
// This had better be an attribute of the DIE we were meant to handle.
|
||||
assert(offset == current.offset_);
|
||||
|
|
|
@ -208,7 +208,7 @@ class DIEHandler {
|
|||
uint64 len) { }
|
||||
virtual void ProcessAttributeString(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const string& data) { }
|
||||
const std::string& data) { }
|
||||
|
||||
// Once we have reported all the DIE's attributes' values, we call
|
||||
// this member function. If it returns false, we skip all the DIE's
|
||||
|
@ -313,7 +313,7 @@ class DIEDispatcher: public Dwarf2Handler {
|
|||
void ProcessAttributeString(uint64 offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const string &data);
|
||||
const std::string &data);
|
||||
void EndDIE(uint64 offset);
|
||||
|
||||
private:
|
||||
|
@ -347,7 +347,7 @@ class DIEDispatcher: public Dwarf2Handler {
|
|||
// - When we decide to ignore a subtree, we only push an entry on
|
||||
// the stack for the root of the tree being ignored, rather than
|
||||
// pushing lots of stack entries with handler_ set to NULL.
|
||||
stack<HandlerStack> die_handlers_;
|
||||
std::stack<HandlerStack> die_handlers_;
|
||||
|
||||
// The root handler. We don't push it on die_handlers_ until we
|
||||
// actually get the StartDIE call for the root.
|
||||
|
|
|
@ -74,7 +74,7 @@ void CompilationUnit::ReadAbbrevs() {
|
|||
iter = sections_.find("__debug_abbrev");
|
||||
assert(iter != sections_.end());
|
||||
|
||||
abbrevs_ = new vector<Abbrev>;
|
||||
abbrevs_ = new std::vector<Abbrev>;
|
||||
abbrevs_->resize(1);
|
||||
|
||||
// The only way to check whether we are reading over the end of the
|
||||
|
@ -121,7 +121,7 @@ void CompilationUnit::ReadAbbrevs() {
|
|||
const enum DwarfAttribute name =
|
||||
static_cast<enum DwarfAttribute>(nametemp);
|
||||
const enum DwarfForm form = static_cast<enum DwarfForm>(formtemp);
|
||||
abbrev.attributes.push_back(make_pair(name, form));
|
||||
abbrev.attributes.push_back(std::make_pair(name, form));
|
||||
}
|
||||
assert(abbrev.number == abbrevs_->size());
|
||||
abbrevs_->push_back(abbrev);
|
||||
|
@ -493,7 +493,7 @@ void CompilationUnit::ProcessDIEs() {
|
|||
else
|
||||
lengthstart += 4;
|
||||
|
||||
stack<uint64> die_stack;
|
||||
std::stack<uint64> die_stack;
|
||||
|
||||
while (dieptr < (lengthstart + header_.length)) {
|
||||
// We give the user the absolute offset from the beginning of
|
||||
|
@ -583,7 +583,7 @@ void LineInfo::ReadHeader() {
|
|||
header_.opcode_base = reader_->ReadOneByte(lineptr);
|
||||
lineptr += 1;
|
||||
|
||||
header_.std_opcode_lengths = new vector<unsigned char>;
|
||||
header_.std_opcode_lengths = new std::vector<unsigned char>;
|
||||
header_.std_opcode_lengths->resize(header_.opcode_base + 1);
|
||||
(*header_.std_opcode_lengths)[0] = 0;
|
||||
for (int i = 1; i < header_.opcode_base; i++) {
|
||||
|
@ -1024,7 +1024,7 @@ class CallFrameInfo::RegisterRule: public CallFrameInfo::Rule {
|
|||
// Rule: EXPRESSION evaluates to the address at which the register is saved.
|
||||
class CallFrameInfo::ExpressionRule: public CallFrameInfo::Rule {
|
||||
public:
|
||||
explicit ExpressionRule(const string &expression)
|
||||
explicit ExpressionRule(const std::string &expression)
|
||||
: expression_(expression) { }
|
||||
~ExpressionRule() { }
|
||||
bool Handle(Handler *handler, uint64 address, int reg) const {
|
||||
|
@ -1038,13 +1038,13 @@ class CallFrameInfo::ExpressionRule: public CallFrameInfo::Rule {
|
|||
}
|
||||
Rule *Copy() const { return new ExpressionRule(*this); }
|
||||
private:
|
||||
string expression_;
|
||||
std::string expression_;
|
||||
};
|
||||
|
||||
// Rule: EXPRESSION evaluates to the address at which the register is saved.
|
||||
class CallFrameInfo::ValExpressionRule: public CallFrameInfo::Rule {
|
||||
public:
|
||||
explicit ValExpressionRule(const string &expression)
|
||||
explicit ValExpressionRule(const std::string &expression)
|
||||
: expression_(expression) { }
|
||||
~ValExpressionRule() { }
|
||||
bool Handle(Handler *handler, uint64 address, int reg) const {
|
||||
|
@ -1059,7 +1059,7 @@ class CallFrameInfo::ValExpressionRule: public CallFrameInfo::Rule {
|
|||
}
|
||||
Rule *Copy() const { return new ValExpressionRule(*this); }
|
||||
private:
|
||||
string expression_;
|
||||
std::string expression_;
|
||||
};
|
||||
|
||||
// A map from register numbers to rules.
|
||||
|
@ -1096,7 +1096,7 @@ class CallFrameInfo::RuleMap {
|
|||
|
||||
private:
|
||||
// A map from register numbers to Rules.
|
||||
typedef map<int, Rule *> RuleByNumber;
|
||||
typedef std::map<int, Rule *> RuleByNumber;
|
||||
|
||||
// Remove all register rules and clear cfa_rule_.
|
||||
void Clear();
|
||||
|
@ -1240,7 +1240,7 @@ class CallFrameInfo::State {
|
|||
unsigned register_number; // A register number.
|
||||
uint64 offset; // An offset or address.
|
||||
long signed_offset; // A signed offset.
|
||||
string expression; // A DWARF expression.
|
||||
std::string expression; // A DWARF expression.
|
||||
};
|
||||
|
||||
// Parse CFI instruction operands from STATE's instruction stream as
|
||||
|
@ -1341,7 +1341,7 @@ class CallFrameInfo::State {
|
|||
|
||||
// A stack of saved states, for DW_CFA_remember_state and
|
||||
// DW_CFA_restore_state.
|
||||
stack<RuleMap> saved_rules_;
|
||||
std::stack<RuleMap> saved_rules_;
|
||||
};
|
||||
|
||||
bool CallFrameInfo::State::InterpretCIE(const CIE &cie) {
|
||||
|
@ -1427,7 +1427,7 @@ bool CallFrameInfo::State::ParseOperands(const char *format,
|
|||
if (len > bytes_left || expression_length > bytes_left - len)
|
||||
return ReportIncomplete();
|
||||
cursor_ += len;
|
||||
operands->expression = string(cursor_, expression_length);
|
||||
operands->expression = std::string(cursor_, expression_length);
|
||||
cursor_ += expression_length;
|
||||
break;
|
||||
}
|
||||
|
@ -1898,7 +1898,8 @@ bool CallFrameInfo::ReadCIEFields(CIE *cie) {
|
|||
memchr(augmentation_start, '\0', cie->end - augmentation_start);
|
||||
if (! augmentation_end) return ReportIncomplete(cie);
|
||||
cursor = static_cast<const char *>(augmentation_end);
|
||||
cie->augmentation = string(augmentation_start, cursor - augmentation_start);
|
||||
cie->augmentation = std::string(augmentation_start,
|
||||
cursor - augmentation_start);
|
||||
// Skip the terminating '\0'.
|
||||
cursor++;
|
||||
|
||||
|
@ -2285,7 +2286,7 @@ void CallFrameInfo::Reporter::UnrecognizedVersion(uint64 offset, int version) {
|
|||
}
|
||||
|
||||
void CallFrameInfo::Reporter::UnrecognizedAugmentation(uint64 offset,
|
||||
const string &aug) {
|
||||
const std::string &aug) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI frame description entry at offset 0x%llx in '%s':"
|
||||
" CIE specifies unrecognized augmentation: '%s'\n",
|
||||
|
|
|
@ -50,8 +50,6 @@
|
|||
#include "common/dwarf/dwarf2enums.h"
|
||||
#include "common/dwarf/types.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace dwarf2reader {
|
||||
struct LineStateMachine;
|
||||
class Dwarf2Handler;
|
||||
|
@ -59,8 +57,9 @@ class LineInfoHandler;
|
|||
|
||||
// This maps from a string naming a section to a pair containing a
|
||||
// the data for the section, and the size of the section.
|
||||
typedef map<string, pair<const char*, uint64> > SectionMap;
|
||||
typedef list<pair<enum DwarfAttribute, enum DwarfForm> > AttributeList;
|
||||
typedef std::map<std::string, std::pair<const char*, uint64> > SectionMap;
|
||||
typedef std::list<std::pair<enum DwarfAttribute, enum DwarfForm> >
|
||||
AttributeList;
|
||||
typedef AttributeList::iterator AttributeIterator;
|
||||
typedef AttributeList::const_iterator ConstAttributeIterator;
|
||||
|
||||
|
@ -75,7 +74,7 @@ struct LineInfoHeader {
|
|||
uint8 opcode_base;
|
||||
// Use a pointer so that signalsafe_addr2line is able to use this structure
|
||||
// without heap allocation problem.
|
||||
vector<unsigned char> *std_opcode_lengths;
|
||||
std::vector<unsigned char> *std_opcode_lengths;
|
||||
};
|
||||
|
||||
class LineInfo {
|
||||
|
@ -157,7 +156,7 @@ class LineInfoHandler {
|
|||
|
||||
// Called when we define a directory. NAME is the directory name,
|
||||
// DIR_NUM is the directory number
|
||||
virtual void DefineDir(const string& name, uint32 dir_num) { }
|
||||
virtual void DefineDir(const std::string& name, uint32 dir_num) { }
|
||||
|
||||
// Called when we define a filename. NAME is the filename, FILE_NUM
|
||||
// is the file number which is -1 if the file index is the next
|
||||
|
@ -166,7 +165,7 @@ class LineInfoHandler {
|
|||
// directory index for the directory name of this file, MOD_TIME is
|
||||
// the modification time of the file, and LENGTH is the length of
|
||||
// the file
|
||||
virtual void DefineFile(const string& name, int32 file_num,
|
||||
virtual void DefineFile(const std::string& name, int32 file_num,
|
||||
uint32 dir_num, uint64 mod_time,
|
||||
uint64 length) { }
|
||||
|
||||
|
@ -313,7 +312,7 @@ class CompilationUnit {
|
|||
// Set of DWARF2/3 abbreviations for this compilation unit. Indexed
|
||||
// by abbreviation number, which means that abbrevs_[0] is not
|
||||
// valid.
|
||||
vector<Abbrev>* abbrevs_;
|
||||
std::vector<Abbrev>* abbrevs_;
|
||||
|
||||
// String section buffer and length, if we have a string section.
|
||||
// This is here to avoid doing a section lookup for strings in
|
||||
|
@ -392,7 +391,7 @@ class Dwarf2Handler {
|
|||
virtual void ProcessAttributeString(uint64 offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const string& data) { }
|
||||
const std::string& data) { }
|
||||
|
||||
// Called when finished processing the DIE at OFFSET.
|
||||
// Because DWARF2/3 specifies a tree of DIEs, you may get starts
|
||||
|
@ -691,7 +690,7 @@ class CallFrameInfo {
|
|||
// A common information entry (CIE).
|
||||
struct CIE: public Entry {
|
||||
uint8 version; // CFI data version number
|
||||
string augmentation; // vendor format extension markers
|
||||
std::string augmentation; // vendor format extension markers
|
||||
uint64 code_alignment_factor; // scale for code address adjustments
|
||||
int data_alignment_factor; // scale for stack pointer adjustments
|
||||
unsigned return_address_register; // which register holds the return addr
|
||||
|
@ -825,7 +824,7 @@ class CallFrameInfo::Handler {
|
|||
// process a given FDE, the parser reiterates the appropriate CIE's
|
||||
// contents at the beginning of the FDE's rules.
|
||||
virtual bool Entry(size_t offset, uint64 address, uint64 length,
|
||||
uint8 version, const string &augmentation,
|
||||
uint8 version, const std::string &augmentation,
|
||||
unsigned return_address) = 0;
|
||||
|
||||
// When the Entry function returns true, the parser calls these
|
||||
|
@ -874,13 +873,13 @@ class CallFrameInfo::Handler {
|
|||
// At ADDRESS, the DWARF expression EXPRESSION yields the address at
|
||||
// which REG was saved.
|
||||
virtual bool ExpressionRule(uint64 address, int reg,
|
||||
const string &expression) = 0;
|
||||
const std::string &expression) = 0;
|
||||
|
||||
// At ADDRESS, the DWARF expression EXPRESSION yields the caller's
|
||||
// value for REG. (This rule doesn't provide an address at which the
|
||||
// register's value is saved.)
|
||||
virtual bool ValExpressionRule(uint64 address, int reg,
|
||||
const string &expression) = 0;
|
||||
const std::string &expression) = 0;
|
||||
|
||||
// Indicate that the rules for the address range reported by the
|
||||
// last call to Entry are complete. End should return true if
|
||||
|
@ -957,8 +956,8 @@ class CallFrameInfo::Reporter {
|
|||
// in a Mach-O section named __debug_frame. If we support
|
||||
// Linux-style exception handling data, we could be reading an
|
||||
// .eh_frame section.
|
||||
Reporter(const string &filename,
|
||||
const string §ion = ".debug_frame")
|
||||
Reporter(const std::string &filename,
|
||||
const std::string §ion = ".debug_frame")
|
||||
: filename_(filename), section_(section) { }
|
||||
virtual ~Reporter() { }
|
||||
|
||||
|
@ -990,7 +989,7 @@ class CallFrameInfo::Reporter {
|
|||
// which we don't recognize. We cannot parse DWARF CFI if it uses
|
||||
// augmentations we don't recognize.
|
||||
virtual void UnrecognizedAugmentation(uint64 offset,
|
||||
const string &augmentation);
|
||||
const std::string &augmentation);
|
||||
|
||||
// The pointer encoding ENCODING, specified by the CIE at OFFSET, is not
|
||||
// a valid encoding.
|
||||
|
@ -1031,10 +1030,10 @@ class CallFrameInfo::Reporter {
|
|||
|
||||
protected:
|
||||
// The name of the file whose CFI we're reading.
|
||||
string filename_;
|
||||
std::string filename_;
|
||||
|
||||
// The name of the CFI section in that file.
|
||||
string section_;
|
||||
std::string section_;
|
||||
};
|
||||
|
||||
} // namespace dwarf2reader
|
||||
|
|
|
@ -41,13 +41,14 @@
|
|||
// it until we actually have to deal with DWARF on Windows.
|
||||
|
||||
// Return true if PATH is an absolute path, false if it is relative.
|
||||
static bool PathIsAbsolute(const string &path) {
|
||||
static bool PathIsAbsolute(const std::string &path) {
|
||||
return (path.size() >= 1 && path[0] == '/');
|
||||
}
|
||||
|
||||
// If PATH is an absolute path, return PATH. If PATH is a relative path,
|
||||
// treat it as relative to BASE and return the combined path.
|
||||
static string ExpandPath(const string &path, const string &base) {
|
||||
static std::string ExpandPath(const std::string &path,
|
||||
const std::string &base) {
|
||||
if (PathIsAbsolute(path))
|
||||
return path;
|
||||
return base + "/" + path;
|
||||
|
@ -55,14 +56,14 @@ static string ExpandPath(const string &path, const string &base) {
|
|||
|
||||
namespace google_breakpad {
|
||||
|
||||
void DwarfLineToModule::DefineDir(const string &name, uint32 dir_num) {
|
||||
void DwarfLineToModule::DefineDir(const std::string &name, uint32 dir_num) {
|
||||
// Directory number zero is reserved to mean the compilation
|
||||
// directory. Silently ignore attempts to redefine it.
|
||||
if (dir_num != 0)
|
||||
directories_[dir_num] = name;
|
||||
}
|
||||
|
||||
void DwarfLineToModule::DefineFile(const string &name, int32 file_num,
|
||||
void DwarfLineToModule::DefineFile(const std::string &name, int32 file_num,
|
||||
uint32 dir_num, uint64 mod_time,
|
||||
uint64 length) {
|
||||
if (file_num == -1)
|
||||
|
|
Loading…
Reference in a new issue