diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-08-07 08:00:07 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-08-07 08:00:07 +0200 |
commit | dbeab89b5b74ca0ff789be376c94d64f5e937f11 (patch) | |
tree | 9679d7251ab50bdae85f0af2aaa79bec90970358 /compilerplugins | |
parent | a1e0232b5179c12892b33cd368b9d17a65c398e0 (diff) |
Adopt loplugin:casttovoid to Objective C
Change-Id: I71bad86a383a9b906b02ec968dc32e9acd0bec26
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/casttovoid.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/compilerplugins/clang/casttovoid.cxx b/compilerplugins/clang/casttovoid.cxx index 49c086139a00..10f1a6556d66 100644 --- a/compilerplugins/clang/casttovoid.cxx +++ b/compilerplugins/clang/casttovoid.cxx @@ -152,6 +152,15 @@ public: return ret; } + bool TraverseObjCMethodDecl(ObjCMethodDecl * decl) { + returnTypes_.push(decl->getReturnType()); + auto const ret = RecursiveASTVisitor::TraverseObjCMethodDecl(decl); + assert(!returnTypes_.empty()); + assert(returnTypes_.top() == decl->getReturnType()); + returnTypes_.pop(); + return ret; + } + bool TraverseConstructorInitializer(CXXCtorInitializer * init) { if (auto const field = init->getAnyMember()) { if (loplugin::TypeCheck(field->getType()).LvalueReference()) { @@ -340,8 +349,11 @@ private: { continue; } - auto const fun = dyn_cast_or_null<FunctionDecl>( - i.first->getDeclContext()); + auto const ctxt = i.first->getDeclContext(); + if (dyn_cast_or_null<ObjCMethodDecl>(ctxt) != nullptr) { + continue; + } + auto const fun = dyn_cast_or_null<FunctionDecl>(ctxt); assert(fun != nullptr); if (containsPreprocessingConditionalInclusion( fun->getSourceRange())) |