]> granicus.if.org Git - clang/commitdiff
[analyzer] Fully-covered switch for families in isTrackedFamily()
authorAnton Yartsev <anton.yartsev@gmail.com>
Fri, 5 Apr 2013 00:31:02 +0000 (00:31 +0000)
committerAnton Yartsev <anton.yartsev@gmail.com>
Fri, 5 Apr 2013 00:31:02 +0000 (00:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178820 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Checkers/MallocChecker.cpp

index f686735010dde38da0a4e6f9b3d0279282eb4082..f92178f6fc774f78e38d7503d5441a4b4b260f5d 100644 (file)
@@ -1068,13 +1068,24 @@ ProgramStateRef MallocChecker::FreeMemAux(CheckerContext &C,
 }
 
 bool MallocChecker::isTrackedFamily(AllocationFamily Family) const {
-  if (Family == AF_Malloc &&
-    (!Filter.CMallocOptimistic && !Filter.CMallocPessimistic))
-    return false;
-
-  if ((Family == AF_CXXNew || Family == AF_CXXNewArray) &&
-    !Filter.CNewDeleteChecker)
-    return false;
+  switch (Family) {
+  case AF_Malloc: {
+    if (!Filter.CMallocOptimistic && !Filter.CMallocPessimistic)
+      return false;
+    break;  
+  }
+  case AF_CXXNew:
+  case AF_CXXNewArray: {
+    if (!Filter.CNewDeleteChecker)
+      return false;
+    break;
+  }
+  case AF_None: {
+    return true;
+  }
+  default:
+    llvm_unreachable("unhandled family");
+  }
 
   return true;
 }