[llvm] r205367 - Fix accidental fallthrough in DebugLocEntry::hasSameValueOrLocation

David Blaikie dblaikie at gmail.com
Tue Apr 1 15:25:09 PDT 2014


Author: dblaikie
Date: Tue Apr  1 17:25:09 2014
New Revision: 205367

URL: http://llvm.org/viewvc/llvm-project?rev=205367&view=rev
Log:
Fix accidental fallthrough in DebugLocEntry::hasSameValueOrLocation

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.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h?rev=205367&r1=205366&r2=205367&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h Tue Apr  1 17:25:09 2014
@@ -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:





More information about the llvm-commits mailing list