[2/3] abidw: remove always true test in resolve_declaration_only_classes

Message ID 20220825114856.3137373-3-gprocida@google.com
State New
Headers
Series Improve resolution of declaration-only enums |

Commit Message

Giuliano Procida Aug. 25, 2022, 11:48 a.m. UTC
  The code that makes the last attempt to resolve declaration-only types
was protected by a conditional checking that the number of TUs for a
given type was more than 1. The previous branch checked for exactly 1.
However, the entire block is inside a conditional where the number of
TUs is guaranteed to be greater than 0.

Removing the conditional makes it clear that this branch handles all
remaining cases.

	* src/abg-dwarf-reader.cc
	(read_context::resolve_declaration_only_classes): Remove
	tautological conditional.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-dwarf-reader.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Dodji Seketeli Aug. 29, 2022, 11:19 a.m. UTC | #1
Giuliano Procida <gprocida@google.com> a écrit:

> The code that makes the last attempt to resolve declaration-only types
> was protected by a conditional checking that the number of TUs for a
> given type was more than 1. The previous branch checked for exactly 1.
> However, the entire block is inside a conditional where the number of
> TUs is guaranteed to be greater than 0.
>
> Removing the conditional makes it clear that this branch handles all
> remaining cases.
>
> 	* src/abg-dwarf-reader.cc
> 	(read_context::resolve_declaration_only_classes): Remove
> 	tautological conditional.
>
> Signed-off-by: Giuliano Procida <gprocida@google.com>

Applied to master, thanks !

[...]

Cheers,
  

Patch

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index a954de6d..b5e60e35 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -4274,7 +4274,7 @@  public:
 		    else if (per_tu_class_map.size() == 1)
 		      (*j)->set_definition_of_declaration
 			(per_tu_class_map.begin()->second);
-		    else if (per_tu_class_map.size() > 1)
+		    else
 		      {
 			// We are in case where there are more than
 			// one definition for the declaration.  Let's