Revert 95546 since it changed the algorithmic characteristics of the convention lookup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95547 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Checker/CocoaConventions.cpp b/lib/Checker/CocoaConventions.cpp
index 9198b3b..ff3a0c9 100644
--- a/lib/Checker/CocoaConventions.cpp
+++ b/lib/Checker/CocoaConventions.cpp
@@ -131,19 +131,19 @@
return C;
}
-bool cocoa::isRefType(QualType RetTy, llvm::StringRef Prefix,
- llvm::StringRef Name) {
+bool cocoa::isRefType(QualType RetTy, const char* prefix,
+ const char* name) {
// Recursively walk the typedef stack, allowing typedefs of reference types.
while (TypedefType* TD = dyn_cast<TypedefType>(RetTy.getTypePtr())) {
llvm::StringRef TDName = TD->getDecl()->getIdentifier()->getName();
- if (TDName.startswith(Prefix) && TDName.endswith("Ref"))
+ if (TDName.startswith(prefix) && TDName.endswith("Ref"))
return true;
RetTy = TD->getDecl()->getUnderlyingType();
}
- if (Name.empty())
+ if (!name)
return false;
// Is the type void*?
@@ -152,7 +152,7 @@
return false;
// Does the name start with the prefix?
- return Name.startswith(Prefix);
+ return llvm::StringRef(name).startswith(prefix);
}
bool cocoa::isCFObjectRef(QualType T) {