[v2] abg-ir.cc: Remove always-true check.

Message ID 20200319143107.254188-1-gprocida@google.com
State Committed
Headers
Series [v2] abg-ir.cc: Remove always-true check. |

Commit Message

Giuliano Procida March 19, 2020, 2:31 p.m. UTC
  There is an instance of a if-statement testing the same variable as
its containing if-statement. The inner test always evaluates to true,
if it is reached.

	* src/abg-ir.cc (types_have_similar_structure): Remove
	identical nested conditional.
	(reference_type_def::reference_type_def): Tabify.

Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-ir.cc | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
  

Comments

Dodji Seketeli March 20, 2020, 11:39 p.m. UTC | #1
Giuliano Procida <gprocida@google.com> a ?crit:

> There is an instance of a if-statement testing the same variable as
> its containing if-statement. The inner test always evaluates to true,
> if it is reached.
>
> 	* src/abg-ir.cc (types_have_similar_structure): Remove
> 	identical nested conditional.
> 	(reference_type_def::reference_type_def): Tabify.

Applied to master.

Thanks.
  

Patch

diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 13023295..e84114cc 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -13573,10 +13573,10 @@  reference_type_def::reference_type_def(const type_base_sptr	pointed_to,
       decl_base_sptr pto = dynamic_pointer_cast<decl_base>(pointed_to);
       string name;
       if (pto)
-        {
-          set_visibility(pto->get_visibility());
-          name = string(pto->get_name()) + "&";
-        }
+	{
+	  set_visibility(pto->get_visibility());
+	  name = string(pto->get_name()) + "&";
+	}
       else
 	name = string(get_type_name(is_function_type(pointed_to),
 				    /*qualified_name=*/true)) + "&";
@@ -22669,11 +22669,10 @@  types_have_similar_structure(const type_base* first, const type_base* second)
 
       if (!was_indirect_type)
 	{
-	  if (!was_indirect_type)
-	    if ((ty1->get_size_in_bits() != ty2->get_size_in_bits())
-		|| (ty1->get_non_static_data_members().size()
-		    != ty2->get_non_static_data_members().size()))
-	      return false;
+	  if ((ty1->get_size_in_bits() != ty2->get_size_in_bits())
+	      || (ty1->get_non_static_data_members().size()
+		  != ty2->get_non_static_data_members().size()))
+	    return false;
 
 	  for (class_or_union::data_members::const_iterator
 		 i = ty1->get_non_static_data_members().begin(),