aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-05-12 04:53:03 +0000
committerTed Kremenek <kremenek@apple.com>2009-05-12 04:53:03 +0000
commit6738b731a6f6621ae920391906132a9cdc09185f (patch)
tree29a7800a0b03b395f3a217ae79ef97e4e69c9b01 /lib/Analysis/CFRefCount.cpp
parentb64c19365deab788753d29c9bc881253c3f16f37 (diff)
Fix <rdar://problem/6877235> Classes typedef-ed to CF objects should get the same treatment as CF objects
This was accomplished by having 'isTypeRef' recursively walk the typedef stack. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71538 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r--lib/Analysis/CFRefCount.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index bc140077dc..5120d4f0fc 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -225,9 +225,17 @@ static bool hasSuffix(const char* s, const char* suffix) {
static bool isRefType(QualType RetTy, const char* prefix,
ASTContext* Ctx = 0, const char* name = 0) {
- if (TypedefType* TD = dyn_cast<TypedefType>(RetTy.getTypePtr())) {
- const char* TDName = TD->getDecl()->getIdentifier()->getName();
- return hasPrefix(TDName, prefix) && hasSuffix(TDName, "Ref");
+ // Recursively walk the typedef stack, allowing typedefs of reference types.
+ while (1) {
+ if (TypedefType* TD = dyn_cast<TypedefType>(RetTy.getTypePtr())) {
+ const char* TDName = TD->getDecl()->getIdentifier()->getName();
+ if (hasPrefix(TDName, prefix) && hasSuffix(TDName, "Ref"))
+ return true;
+
+ RetTy = TD->getDecl()->getUnderlyingType();
+ continue;
+ }
+ break;
}
if (!Ctx || !name)