Fix accidental fallthrough in DebugLocEntry::hasSameValueOrLocation
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 1 Apr 2014 22:25:09 +0000 (22:25 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 1 Apr 2014 22:25:09 +0000 (22:25 +0000)
No test case (this would invoke UB by examining uninitialized members,
etc, at best - and this code is apparently untested anyway - I'm about
to fix that)

Code review feedback from Adrian Prantl on r205360.

llvm-svn: 205367

llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h

index 9f5be6164f51484cf0e16379c402d8411893f636..976edf0a2ab7db7aa180dc884becf6964585d896 100644 (file)
@@ -46,18 +46,23 @@ class DebugLocEntry {
     if (EntryKind != Next.EntryKind)
       return false;
 
+    bool EqualValues;
     switch (EntryKind) {
     case E_Location:
-      if (Loc != Next.Loc) return false;
+      EqualValues = Loc == Next.Loc;
+      break;
     case E_Integer:
-      if (Constants.Int != Next.Constants.Int) return false;
+      EqualValues = Constants.Int == Next.Constants.Int;
+      break;
     case E_ConstantFP:
-      if (Constants.CFP != Next.Constants.CFP) return false;
+      EqualValues = Constants.CFP == Next.Constants.CFP;
+      break;
     case E_ConstantInt:
-      if (Constants.CIP != Next.Constants.CIP) return false;
+      EqualValues = Constants.CIP == Next.Constants.CIP;
+      break;
     }
 
-    return true;
+    return EqualValues;
   }
 
 public: