[cfe-commits] r139474 - in /cfe/trunk/lib: Analysis/ThreadSafety.cpp Sema/SemaOverload.cpp

Benjamin Kramer benny.kra at googlemail.com
Sat Sep 10 14:52:04 PDT 2011


Author: d0k
Date: Sat Sep 10 16:52:04 2011
New Revision: 139474

URL: http://llvm.org/viewvc/llvm-project?rev=139474&view=rev
Log:
Silence "end of non-void function" warnings with llvm_unreachable and add an assert.

Modified:
    cfe/trunk/lib/Analysis/ThreadSafety.cpp
    cfe/trunk/lib/Sema/SemaOverload.cpp

Modified: cfe/trunk/lib/Analysis/ThreadSafety.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ThreadSafety.cpp?rev=139474&r1=139473&r2=139474&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ThreadSafety.cpp (original)
+++ cfe/trunk/lib/Analysis/ThreadSafety.cpp Sat Sep 10 16:52:04 2011
@@ -300,6 +300,7 @@
       case LK_Exclusive:
         return locksetContains(Lock, KindRequested);
     }
+    llvm_unreachable("Unknown LockKind");
   }
 
 public:
@@ -805,5 +806,6 @@
     case AK_Written :
       return LK_Exclusive;
   }
+  llvm_unreachable("Unknown AccessKind");
 }
 }} // end namespace clang::thread_safety

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=139474&r1=139473&r2=139474&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Sat Sep 10 16:52:04 2011
@@ -7288,10 +7288,12 @@
   return SourceLocation();
 }
 
-static unsigned RankDeductionFailure(
-    const OverloadCandidate::DeductionFailureInfo &DFI) {
+static unsigned
+RankDeductionFailure(const OverloadCandidate::DeductionFailureInfo &DFI) {
   switch ((Sema::TemplateDeductionResult)DFI.Result) {
   case Sema::TDK_Success:
+    assert(0 && "TDK_success while diagnosing bad deduction");
+
   case Sema::TDK_Incomplete:
     return 1;
 
@@ -7314,6 +7316,7 @@
   case Sema::TDK_TooFewArguments:
     return 6;
   }
+  llvm_unreachable("Unhandled deduction result");
 }
 
 struct CompareOverloadCandidatesForDisplay {





More information about the cfe-commits mailing list