[cfe-commits] r73197 - /cfe/trunk/lib/Analysis/CFRefCount.cpp
Ted Kremenek
kremenek at apple.com
Thu Jun 11 11:10:49 PDT 2009
Author: kremenek
Date: Thu Jun 11 13:10:48 2009
New Revision: 73197
URL: http://llvm.org/viewvc/llvm-project?rev=73197&view=rev
Log:
Refactor some function name -> summary lookup using a switch statement.
Modified:
cfe/trunk/lib/Analysis/CFRefCount.cpp
Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=73197&r1=73196&r2=73197&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Thu Jun 11 13:10:48 2009
@@ -971,15 +971,31 @@
// 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 @@
: 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.
More information about the cfe-commits
mailing list