[cfe-commits] r84338 - /cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp
Daniel Dunbar
daniel at zuster.org
Sat Oct 17 11:12:22 PDT 2009
Author: ddunbar
Date: Sat Oct 17 13:12:21 2009
New Revision: 84338
URL: http://llvm.org/viewvc/llvm-project?rev=84338&view=rev
Log:
Simplify.
Modified:
cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp
Modified: cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp?rev=84338&r1=84337&r2=84338&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp (original)
+++ cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp Sat Oct 17 13:12:21 2009
@@ -62,7 +62,7 @@
BugReporter& BR;
ASTContext &Ctx;
- bool isNSString(const ObjCInterfaceType *T, const char* suffix);
+ bool isNSString(const ObjCInterfaceType *T, llvm::StringRef suffix);
bool AuditNSString(ExplodedNode* N, const ObjCMessageExpr* ME);
void Warn(ExplodedNode* N, const Expr* E, const std::string& s);
@@ -114,18 +114,8 @@
if (!ReceiverType)
return false;
- const char* name = ReceiverType->getDecl()->getIdentifier()->getName();
-
- if (!name)
- return false;
-
- if (name[0] != 'N' || name[1] != 'S')
- return false;
-
- name += 2;
-
- // FIXME: Make all of this faster.
- if (isNSString(ReceiverType, name))
+ if (isNSString(ReceiverType,
+ ReceiverType->getDecl()->getIdentifier()->getNameStr()))
return AuditNSString(N, ME);
return false;
@@ -158,8 +148,8 @@
//===----------------------------------------------------------------------===//
bool BasicObjCFoundationChecks::isNSString(const ObjCInterfaceType *T,
- const char* suffix) {
- return !strcmp("String", suffix) || !strcmp("MutableString", suffix);
+ llvm::StringRef ClassName) {
+ return ClassName == "NSString" || ClassName == "NSMutableString";
}
bool BasicObjCFoundationChecks::AuditNSString(ExplodedNode* N,
More information about the cfe-commits
mailing list