[PATCH] Fix recently introduced warning in Sema

Xan López xan at igalia.com
Mon Jul 20 01:02:51 PDT 2015


(Please commit if accepted, I do not have commit rights)
-------------- next part --------------
>From 0b6f7194d37351ba3c329e5ae8e4291a62b56ba3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Xan=20L=C3=B3pez?= <xan at igalia.com>
Date: Mon, 20 Jul 2015 09:59:57 +0200
Subject: [PATCH] Sema: fix warning in assertion

r242652 introduced a warning, since IdealIndex is an unsigned int and
the >= check will always be true. Asserting IdealIndex < NumIdealInts
should be enough, and more precise than the previous assertion
(IdealIndex != NumIdealInts).
---
 lib/Sema/SemaDeclCXX.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index f20ece5..50890fb 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -4138,7 +4138,7 @@ static void DiagnoseBaseOrMemInitializerOrder(
         if (InitKey == IdealInitKeys[IdealIndex])
           break;
 
-      assert(IdealIndex >= 0 && IdealIndex < NumIdealInits &&
+      assert(IdealIndex < NumIdealInits &&
              "initializer not found in initializer list");
     }
 
-- 
2.4.3



More information about the llvm-commits mailing list