diff options
author | Anna Zaks <ganna@apple.com> | 2013-01-11 03:52:37 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2013-01-11 03:52:37 +0000 |
commit | ae81e172e93b75594c7053f3226a16b9d8daa6fd (patch) | |
tree | 406e5783612a02af6e36e0da953e44d6104dd697 /lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp | |
parent | 0214b992655df72b29bcc6ded9d48748224d3496 (diff) |
[analyzer] Ivar invalidation: track ivars declared in categories.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172168 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp b/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp index 80cb58d76b..527470a17c 100644 --- a/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp @@ -227,15 +227,23 @@ void IvarInvalidationChecker::containsInvalidationMethod( } // If interface, check all parent protocols and super. - // TODO: Visit all categories in case the invalidation method is declared in - // a category. - if (const ObjCInterfaceDecl *InterfaceD = dyn_cast<ObjCInterfaceDecl>(D)) { + if (const ObjCInterfaceDecl *InterfD = dyn_cast<ObjCInterfaceDecl>(D)) { + + // Visit all protocols. for (ObjCInterfaceDecl::protocol_iterator - I = InterfaceD->protocol_begin(), - E = InterfaceD->protocol_end(); I != E; ++I) { + I = InterfD->protocol_begin(), + E = InterfD->protocol_end(); I != E; ++I) { containsInvalidationMethod(*I, OutInfo); } - containsInvalidationMethod(InterfaceD->getSuperClass(), OutInfo); + + // Visit all categories in case the invalidation method is declared in + // a category. + for (const ObjCCategoryDecl *I = InterfD->getFirstClassExtension(); I; + I = I->getNextClassExtension()) { + containsInvalidationMethod(I, OutInfo); + } + + containsInvalidationMethod(InterfD->getSuperClass(), OutInfo); return; } @@ -249,7 +257,7 @@ void IvarInvalidationChecker::containsInvalidationMethod( return; } - llvm_unreachable("One of the casts above should have succeeded."); + return; } bool IvarInvalidationChecker::trackIvar(const ObjCIvarDecl *Iv, |