diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-05-12 04:53:03 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-05-12 04:53:03 +0000 |
commit | 95d181936a19882ee1ca82b65cc40ef8ebf45905 (patch) | |
tree | b7d8aa622d9a3b6b4adc30be2692316cf2c57620 /clang/lib/Analysis/CFRefCount.cpp | |
parent | 63f5f68024a8117d09c6198935cb46ab3d19ed4d (diff) | |
download | bcm5719-llvm-95d181936a19882ee1ca82b65cc40ef8ebf45905.tar.gz bcm5719-llvm-95d181936a19882ee1ca82b65cc40ef8ebf45905.zip |
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.
llvm-svn: 71538
Diffstat (limited to 'clang/lib/Analysis/CFRefCount.cpp')
-rw-r--r-- | clang/lib/Analysis/CFRefCount.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp index bc140077dc7..5120d4f0fc5 100644 --- a/clang/lib/Analysis/CFRefCount.cpp +++ b/clang/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) |