diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-02-08 16:39:00 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-02-08 16:39:00 +0000 |
commit | de69f7044356093247f7453373bf86ac06ddc512 (patch) | |
tree | d2281e76466c75452ecb19f46f537c2b7a822cea /lib/Checker/CocoaConventions.cpp | |
parent | 1397663af9dbcc24dbf0e11de43931b3dc08fdbb (diff) |
Simplify code with StringRef.
3 files changed, 76 insertions(+), 153 deletions(-)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95546 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/CocoaConventions.cpp')
-rw-r--r-- | lib/Checker/CocoaConventions.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Checker/CocoaConventions.cpp b/lib/Checker/CocoaConventions.cpp index ff3a0c97b4..9198b3be80 100644 --- a/lib/Checker/CocoaConventions.cpp +++ b/lib/Checker/CocoaConventions.cpp @@ -131,19 +131,19 @@ cocoa::NamingConvention cocoa::deriveNamingConvention(Selector S) { return C; } -bool cocoa::isRefType(QualType RetTy, const char* prefix, - const char* name) { +bool cocoa::isRefType(QualType RetTy, llvm::StringRef Prefix, + llvm::StringRef 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) + if (Name.empty()) return false; // Is the type void*? @@ -152,7 +152,7 @@ bool cocoa::isRefType(QualType RetTy, const char* prefix, return false; // Does the name start with the prefix? - return llvm::StringRef(name).startswith(prefix); + return Name.startswith(Prefix); } bool cocoa::isCFObjectRef(QualType T) { |