[llvm] r185396 - Fix up some asserts that are within an if statement. This removes the need

Richard Trieu rtrieu at google.com
Mon Jul 1 16:42:53 PDT 2013


Author: rtrieu
Date: Mon Jul  1 18:42:53 2013
New Revision: 185396

URL: http://llvm.org/viewvc/llvm-project?rev=185396&view=rev
Log:
Fix up some asserts that are within an if statement.  This removes the need
for assert(0 && "text").

Modified:
    llvm/trunk/include/llvm/TableGen/Record.h

Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=185396&r1=185395&r2=185396&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Mon Jul  1 18:42:53 2013
@@ -1798,10 +1798,12 @@ struct LessRecordRegister {
         return LHSPart.second.size() < RHSPart.second.size();
 
       unsigned LHSVal, RHSVal;
-      if (LHSPart.second.getAsInteger(10, LHSVal))
-        assert(0 && "Unable to convert LHS to integer.");
-      if (RHSPart.second.getAsInteger(10, RHSVal))
-        assert(0 && "Unable to convert RHS to integer.");
+
+      bool LHSFailed = LHSPart.second.getAsInteger(10, LHSVal); (void)LHSFailed;
+      assert(!LHSFailed && "Unable to convert LHS to integer.");
+      bool RHSFailed = RHSPart.second.getAsInteger(10, RHSVal); (void)RHSFailed;
+      assert(!RHSFailed && "Unable to convert RHS to integer.");
+
       if (LHSVal != RHSVal)
         return LHSVal < RHSVal;
     }





More information about the llvm-commits mailing list