From 608d142aaa1da8e68e4635db77fd9f36d337276c Mon Sep 17 00:00:00 2001 From: jimblandy Date: Tue, 30 Mar 2010 21:36:58 +0000 Subject: 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 --- src/common/dwarf/dwarf2reader.cc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/common/dwarf/dwarf2reader.cc') diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc index 2952243c..b2b9d0de 100644 --- a/src/common/dwarf/dwarf2reader.cc +++ b/src/common/dwarf/dwarf2reader.cc @@ -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(&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(&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(&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(&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(&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(&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(&rhs); return (our_rhs && expression_ == our_rhs->expression_); -- cgit v1.2.1