summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-02-21 23:38:54 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-02-21 23:47:22 +0100
commit411fcfff58bc49699b525a0e43d75b9f6121da6f (patch)
tree9477dff3597f71eeef9dc205d34130d561f96a3a /compilerplugins
parent278409c3f175b562453c8a7a0e139eadfe41ba11 (diff)
ParentBuilder needs support for ObjCMethodDecl
Change-Id: I8883649da31eabbc5a0f9780fb953ad58f154e1e
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/plugin.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index 88841ea308a3..48c98430d082 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -60,6 +60,7 @@ const Stmt* Plugin::parentStmt( const Stmt* stmt )
{
if( parents.empty())
buildParents( compiler );
+if(parents.count(stmt)!=1)stmt->dump();
assert( parents.count( stmt ) == 1 );
return parents[ stmt ];
}
@@ -79,6 +80,7 @@ class ParentBuilder
{
public:
bool VisitFunctionDecl( const FunctionDecl* function );
+ bool VisitObjCMethodDecl( const ObjCMethodDecl* method );
void walk( const Stmt* stmt );
unordered_map< const Stmt*, const Stmt* >* parents;
};
@@ -107,6 +109,19 @@ bool ParentBuilder::VisitFunctionDecl( const FunctionDecl* function )
return true;
}
+bool ParentBuilder::VisitObjCMethodDecl( const ObjCMethodDecl* method )
+ {
+// if( ignoreLocation( declaration ))
+// return true; ???
+ if( method->hasBody())
+ {
+ const Stmt* body = method->getBody();
+ (*parents)[ body ] = NULL; // no parent
+ walk( body );
+ }
+ return true;
+ }
+
void ParentBuilder::walk( const Stmt* stmt )
{
for( ConstStmtIterator it = stmt->child_begin();