[llvm] [DebugInfo] Get rid of redundant conditional checks in `/DebugInfo` (PR #92111)

Rajveer Singh Bharadwaj via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 05:43:54 PDT 2024


https://github.com/Rajveer100 created https://github.com/llvm/llvm-project/pull/92111

Resolves #90326

>From 87601356bf03d29bdc5107881ce936debdf6cb56 Mon Sep 17 00:00:00 2001
From: Rajveer <rajveer.developer at icloud.com>
Date: Tue, 14 May 2024 18:09:11 +0530
Subject: [PATCH] [DebugInfo] Get rid of redundant conditional checks in
 `/DebugInfo`

Resolves #90326
---
 llvm/include/llvm/DebugInfo/LogicalView/Core/LVObject.h | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVObject.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVObject.h
index 3f7f8c7838fd1..efc8db12a6972 100644
--- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVObject.h
+++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVObject.h
@@ -246,20 +246,17 @@ class LVObject {
   virtual void setName(StringRef ObjectName) {}
 
   LVElement *getParent() const {
-    assert((!Parent.Element ||
-            (Parent.Element && static_cast<LVElement *>(Parent.Element))) &&
+    assert((!Parent.Element || static_cast<LVElement *>(Parent.Element)) &&
            "Invalid element");
     return Parent.Element;
   }
   LVScope *getParentScope() const {
-    assert((!Parent.Scope ||
-            (Parent.Scope && static_cast<LVScope *>(Parent.Scope))) &&
+    assert((!Parent.Scope || static_cast<LVScope *>(Parent.Scope)) &&
            "Invalid scope");
     return Parent.Scope;
   }
   LVSymbol *getParentSymbol() const {
-    assert((!Parent.Symbol ||
-            (Parent.Symbol && static_cast<LVSymbol *>(Parent.Symbol))) &&
+    assert((!Parent.Symbol || static_cast<LVSymbol *>(Parent.Symbol)) &&
            "Invalid symbol");
     return Parent.Symbol;
   }



More information about the llvm-commits mailing list