diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-06-11 18:10:48 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-06-11 18:10:48 +0000 |
commit | a74ead410395f096095820fd2359082186aac39e (patch) | |
tree | cfb764152f8c2bd1b3818cda432b12dda11c0f73 | |
parent | 74eba0b6798cc9d5b1052cae46a9e067e7292cac (diff) | |
download | bcm5719-llvm-a74ead410395f096095820fd2359082186aac39e.tar.gz bcm5719-llvm-a74ead410395f096095820fd2359082186aac39e.zip |
Refactor some function name -> summary lookup using a switch statement.
llvm-svn: 73197
-rw-r--r-- | clang/lib/Analysis/CFRefCount.cpp | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp index 532d16da0f0..2053d2c86c0 100644 --- a/clang/lib/Analysis/CFRefCount.cpp +++ b/clang/lib/Analysis/CFRefCount.cpp @@ -971,15 +971,31 @@ RetainSummary* RetainSummaryManager::getSummary(FunctionDecl* FD) { // FIXME: This should all be refactored into a chain of "summary lookup" // filters. - if (strcmp(FName, "IOServiceGetMatchingServices") == 0) { - // FIXES: <rdar://problem/6326900> - // This should be addressed using a API table. This strcmp is also - // a little gross, but there is no need to super optimize here. - assert (ScratchArgs.isEmpty()); - ScratchArgs = AF.Add(ScratchArgs, 1, DecRef); - S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing); - break; - } + switch (strlen(FName)) { + default: break; + case 17: + // Handle: id NSMakeCollectable(CFTypeRef) + if (!memcmp(FName, "NSMakeCollectable", 17)) { + S = (RetTy == Ctx.getObjCIdType()) + ? getUnarySummary(FT, cfmakecollectable) + : getPersistentStopSummary(); + } + break; + case 28: + if (!memcmp(FName, "IOServiceGetMatchingServices", 28)) { + // FIXES: <rdar://problem/6326900> + // This should be addressed using a API table. This strcmp is also + // a little gross, but there is no need to super optimize here. + assert (ScratchArgs.isEmpty()); + ScratchArgs = AF.Add(ScratchArgs, 1, DecRef); + S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing); + } + break; + } + + // Did we get a summary? + if (S) + break; // Enable this code once the semantics of NSDeallocateObject are resolved // for GC. <rdar://problem/6619988> @@ -992,15 +1008,6 @@ RetainSummary* RetainSummaryManager::getSummary(FunctionDecl* FD) { : getPersistentStopSummary(); } #endif - - // Handle: id NSMakeCollectable(CFTypeRef) - if (strcmp(FName, "NSMakeCollectable") == 0) { - S = (RetTy == Ctx.getObjCIdType()) - ? getUnarySummary(FT, cfmakecollectable) - : getPersistentStopSummary(); - - break; - } if (RetTy->isPointerType()) { // For CoreFoundation ('CF') types. |