]> granicus.if.org Git - clang/commitdiff
StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp: Tweak ContainerNonEmptyMap...
authorNAKAMURA Takumi <geek4civic@gmail.com>
Fri, 8 Nov 2013 04:00:53 +0000 (04:00 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Fri, 8 Nov 2013 04:00:53 +0000 (04:00 +0000)
In ADT/ImmutableSet, ImutProfileInfo<bool> cannot be matched to ImutProfileInteger.
I didn't have idea it'd the right way if PROFILE_INTEGER_INFO(bool) could be added there.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194244 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp

index f66f8b75ed383cab5a72bab75c55f8a6965015c3..83851eb9ae6f737ca2d847dabee3139d74df9f06 100644 (file)
@@ -790,7 +790,7 @@ void VariadicMethodTypeChecker::checkPreObjCMessage(const ObjCMethodCall &msg,
 // The map from container symbol to the container count symbol.
 // We currently will remember the last countainer count symbol encountered.
 REGISTER_MAP_WITH_PROGRAMSTATE(ContainerCountMap, SymbolRef, SymbolRef)
-REGISTER_MAP_WITH_PROGRAMSTATE(ContainerNonEmptyMap, SymbolRef, bool)
+REGISTER_MAP_WITH_PROGRAMSTATE(ContainerNonEmptyMap, SymbolRef, int)
 
 namespace {
 class ObjCLoopChecker
@@ -906,7 +906,7 @@ assumeCollectionNonEmpty(CheckerContext &C, ProgramStateRef State,
 
   const SymbolRef *CountS = State->get<ContainerCountMap>(CollectionS);
   if (!CountS) {
-    const bool *KnownNonEmpty = State->get<ContainerNonEmptyMap>(CollectionS);
+    const int *KnownNonEmpty = State->get<ContainerNonEmptyMap>(CollectionS);
     if (!KnownNonEmpty)
       return State->set<ContainerNonEmptyMap>(CollectionS, Assumption);
     return (Assumption == *KnownNonEmpty) ? State : NULL;
@@ -1036,7 +1036,7 @@ void ObjCLoopChecker::checkPostObjCMessage(const ObjCMethodCall &M,
     C.getSymbolManager().addSymbolDependency(ContainerS, CountS);
     State = State->set<ContainerCountMap>(ContainerS, CountS);
 
-    if (const bool *NonEmpty = State->get<ContainerNonEmptyMap>(ContainerS)) {
+    if (const int *NonEmpty = State->get<ContainerNonEmptyMap>(ContainerS)) {
       State = State->remove<ContainerNonEmptyMap>(ContainerS);
       State = assumeCollectionNonEmpty(C, State, ContainerS, *NonEmpty);
     }