diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-04-23 01:02:12 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-04-23 01:02:12 +0000 |
| commit | 29bd76fd040dea09fe65ee9eabd0fd7d5149e916 (patch) | |
| tree | aea633ad9960193a30f3e7bf41cea3326a4837ec /clang/lib/Analysis | |
| parent | 14efb90fcfb683045e3457790a7b6ed76edfecd4 (diff) | |
| download | bcm5719-llvm-29bd76fd040dea09fe65ee9eabd0fd7d5149e916.tar.gz bcm5719-llvm-29bd76fd040dea09fe65ee9eabd0fd7d5149e916.zip | |
Eliminate the three SmallVectors in ObjCImplDecl (for instance
methods, class methods, and property implementations) and instead
place all of these entities into the DeclContext.
This eliminates more linear walks when looking for class or instance
methods and should make PCH (de-)serialization of ObjCDecls trivial
(and lazy).
llvm-svn: 69849
Diffstat (limited to 'clang/lib/Analysis')
| -rw-r--r-- | clang/lib/Analysis/CheckObjCDealloc.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/Analysis/CheckObjCInstMethSignature.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/Analysis/CheckObjCUnusedIVars.cpp | 13 |
3 files changed, 15 insertions, 14 deletions
diff --git a/clang/lib/Analysis/CheckObjCDealloc.cpp b/clang/lib/Analysis/CheckObjCDealloc.cpp index 0d6e7e46a0b..f50d7a19c42 100644 --- a/clang/lib/Analysis/CheckObjCDealloc.cpp +++ b/clang/lib/Analysis/CheckObjCDealloc.cpp @@ -147,8 +147,8 @@ void clang::CheckObjCDealloc(ObjCImplementationDecl* D, ObjCMethodDecl* MD = 0; // Scan the instance methods for "dealloc". - for (ObjCImplementationDecl::instmeth_iterator I = D->instmeth_begin(), - E = D->instmeth_end(); I!=E; ++I) { + for (ObjCImplementationDecl::instmeth_iterator I = D->instmeth_begin(Ctx), + E = D->instmeth_end(Ctx); I!=E; ++I) { if ((*I)->getSelector() == S) { MD = *I; @@ -198,8 +198,8 @@ void clang::CheckObjCDealloc(ObjCImplementationDecl* D, // Scan for missing and extra releases of ivars used by implementations // of synthesized properties - for (ObjCImplementationDecl::propimpl_iterator I = D->propimpl_begin(), - E = D->propimpl_end(); I!=E; ++I) { + for (ObjCImplementationDecl::propimpl_iterator I = D->propimpl_begin(Ctx), + E = D->propimpl_end(Ctx); I!=E; ++I) { // We can only check the synthesized properties if((*I)->getPropertyImplementation() != ObjCPropertyImplDecl::Synthesize) diff --git a/clang/lib/Analysis/CheckObjCInstMethSignature.cpp b/clang/lib/Analysis/CheckObjCInstMethSignature.cpp index 97e77cc50da..9fec7c1dc11 100644 --- a/clang/lib/Analysis/CheckObjCInstMethSignature.cpp +++ b/clang/lib/Analysis/CheckObjCInstMethSignature.cpp @@ -79,13 +79,15 @@ void clang::CheckObjCInstMethSignature(ObjCImplementationDecl* ID, if (!C) return; + ASTContext& Ctx = BR.getContext(); + // Build a DenseMap of the methods for quick querying. typedef llvm::DenseMap<Selector,ObjCMethodDecl*> MapTy; MapTy IMeths; unsigned NumMethods = 0; - for (ObjCImplementationDecl::instmeth_iterator I=ID->instmeth_begin(), - E=ID->instmeth_end(); I!=E; ++I) { + for (ObjCImplementationDecl::instmeth_iterator I=ID->instmeth_begin(Ctx), + E=ID->instmeth_end(Ctx); I!=E; ++I) { ObjCMethodDecl* M = *I; IMeths[M->getSelector()] = M; @@ -94,8 +96,6 @@ void clang::CheckObjCInstMethSignature(ObjCImplementationDecl* ID, // Now recurse the class hierarchy chain looking for methods with the // same signatures. - ASTContext& Ctx = BR.getContext(); - while (C && NumMethods) { for (ObjCInterfaceDecl::instmeth_iterator I=C->instmeth_begin(Ctx), E=C->instmeth_end(Ctx); I!=E; ++I) { diff --git a/clang/lib/Analysis/CheckObjCUnusedIVars.cpp b/clang/lib/Analysis/CheckObjCUnusedIVars.cpp index 57fad8d86b6..7979f9c942e 100644 --- a/clang/lib/Analysis/CheckObjCUnusedIVars.cpp +++ b/clang/lib/Analysis/CheckObjCUnusedIVars.cpp @@ -61,7 +61,8 @@ void clang::CheckObjCUnusedIvar(ObjCImplementationDecl* D, BugReporter& BR) { IvarUsageMap M; - + ASTContext &Ctx = BR.getContext(); + // Iterate over the ivars. for (ObjCInterfaceDecl::ivar_iterator I=ID->ivar_begin(), E=ID->ivar_end(); I!=E; ++I) { @@ -83,14 +84,14 @@ void clang::CheckObjCUnusedIvar(ObjCImplementationDecl* D, BugReporter& BR) { return; // Now scan the methods for accesses. - for (ObjCImplementationDecl::instmeth_iterator I = D->instmeth_begin(), - E = D->instmeth_end(); I!=E; ++I) - Scan(M, (*I)->getBody(BR.getContext())); + for (ObjCImplementationDecl::instmeth_iterator I = D->instmeth_begin(Ctx), + E = D->instmeth_end(Ctx); I!=E; ++I) + Scan(M, (*I)->getBody(Ctx)); // Scan for @synthesized property methods that act as setters/getters // to an ivar. - for (ObjCImplementationDecl::propimpl_iterator I = D->propimpl_begin(), - E = D->propimpl_end(); I!=E; ++I) + for (ObjCImplementationDecl::propimpl_iterator I = D->propimpl_begin(Ctx), + E = D->propimpl_end(Ctx); I!=E; ++I) Scan(M, *I); // Find ivars that are unused. |

