Breakpad DWARF parser: correct comments regarding dynamic_cast.

The comments don't accurately describe what the style guide says.

Regardless of what the style guide says, RTTI seems to make trouble in
practice, because so many people build with it disabled. Since only the
symbol dumper uses RTTI, not the client library, it may be practical for
people to simply enable RTTI for the dumper. Failing that, it may be best
in the long run to violate the style guide and make the code work sans
RTTI.

a=jimblandy, r=mmentovai


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@561 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
jimblandy 2010-03-30 21:36:58 +00:00
parent 00dbb73752
commit 608d142aaa

View File

@ -919,7 +919,8 @@ class CallFrameInfo::UndefinedRule: public CallFrameInfo::Rule {
return handler->UndefinedRule(address, reg);
}
bool operator==(const Rule &rhs) const {
// dynamic_cast is prohibited by Google C++ Style Guide, but justified.
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
const UndefinedRule *our_rhs = dynamic_cast<const UndefinedRule *>(&rhs);
return (our_rhs != NULL);
}
@ -935,7 +936,8 @@ class CallFrameInfo::SameValueRule: public CallFrameInfo::Rule {
return handler->SameValueRule(address, reg);
}
bool operator==(const Rule &rhs) const {
// dynamic_cast is prohibited by Google C++ Style Guide, but justified.
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
const SameValueRule *our_rhs = dynamic_cast<const SameValueRule *>(&rhs);
return (our_rhs != NULL);
}
@ -953,7 +955,8 @@ class CallFrameInfo::OffsetRule: public CallFrameInfo::Rule {
return handler->OffsetRule(address, reg, base_register_, offset_);
}
bool operator==(const Rule &rhs) const {
// dynamic_cast is prohibited by Google C++ Style Guide, but justified.
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
const OffsetRule *our_rhs = dynamic_cast<const OffsetRule *>(&rhs);
return (our_rhs &&
base_register_ == our_rhs->base_register_ &&
@ -981,7 +984,8 @@ class CallFrameInfo::ValOffsetRule: public CallFrameInfo::Rule {
return handler->ValOffsetRule(address, reg, base_register_, offset_);
}
bool operator==(const Rule &rhs) const {
// dynamic_cast is prohibited by Google C++ Style Guide, but justified.
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
const ValOffsetRule *our_rhs = dynamic_cast<const ValOffsetRule *>(&rhs);
return (our_rhs &&
base_register_ == our_rhs->base_register_ &&
@ -1005,7 +1009,8 @@ class CallFrameInfo::RegisterRule: public CallFrameInfo::Rule {
return handler->RegisterRule(address, reg, register_number_);
}
bool operator==(const Rule &rhs) const {
// dynamic_cast is prohibited by Google C++ Style Guide, but justified.
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
const RegisterRule *our_rhs = dynamic_cast<const RegisterRule *>(&rhs);
return (our_rhs && register_number_ == our_rhs->register_number_);
}
@ -1024,7 +1029,8 @@ class CallFrameInfo::ExpressionRule: public CallFrameInfo::Rule {
return handler->ExpressionRule(address, reg, expression_);
}
bool operator==(const Rule &rhs) const {
// dynamic_cast is prohibited by Google C++ Style Guide, but justified.
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
const ExpressionRule *our_rhs = dynamic_cast<const ExpressionRule *>(&rhs);
return (our_rhs && expression_ == our_rhs->expression_);
}
@ -1043,7 +1049,8 @@ class CallFrameInfo::ValExpressionRule: public CallFrameInfo::Rule {
return handler->ValExpressionRule(address, reg, expression_);
}
bool operator==(const Rule &rhs) const {
// dynamic_cast is prohibited by Google C++ Style Guide, but justified.
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
const ValExpressionRule *our_rhs =
dynamic_cast<const ValExpressionRule *>(&rhs);
return (our_rhs && expression_ == our_rhs->expression_);