r178820 - [analyzer] Fully-covered switch for families in isTrackedFamily()
Anton Yartsev
anton.yartsev at gmail.com
Thu Apr 4 17:31:02 PDT 2013
Author: ayartsev
Date: Thu Apr 4 19:31:02 2013
New Revision: 178820
URL: http://llvm.org/viewvc/llvm-project?rev=178820&view=rev
Log:
[analyzer] Fully-covered switch for families in isTrackedFamily()
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=178820&r1=178819&r2=178820&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Thu Apr 4 19:31:02 2013
@@ -1068,13 +1068,24 @@ ProgramStateRef MallocChecker::FreeMemAu
}
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;
}
More information about the cfe-commits
mailing list