Kaydet (Commit) 411fcfff authored tarafından Stephan Bergmann's avatar Stephan Bergmann

ParentBuilder needs support for ObjCMethodDecl

Change-Id: I8883649da31eabbc5a0f9780fb953ad58f154e1e
üst 278409c3
...@@ -60,6 +60,7 @@ const Stmt* Plugin::parentStmt( const Stmt* stmt ) ...@@ -60,6 +60,7 @@ const Stmt* Plugin::parentStmt( const Stmt* stmt )
{ {
if( parents.empty()) if( parents.empty())
buildParents( compiler ); buildParents( compiler );
if(parents.count(stmt)!=1)stmt->dump();
assert( parents.count( stmt ) == 1 ); assert( parents.count( stmt ) == 1 );
return parents[ stmt ]; return parents[ stmt ];
} }
...@@ -79,6 +80,7 @@ class ParentBuilder ...@@ -79,6 +80,7 @@ class ParentBuilder
{ {
public: public:
bool VisitFunctionDecl( const FunctionDecl* function ); bool VisitFunctionDecl( const FunctionDecl* function );
bool VisitObjCMethodDecl( const ObjCMethodDecl* method );
void walk( const Stmt* stmt ); void walk( const Stmt* stmt );
unordered_map< const Stmt*, const Stmt* >* parents; unordered_map< const Stmt*, const Stmt* >* parents;
}; };
...@@ -107,6 +109,19 @@ bool ParentBuilder::VisitFunctionDecl( const FunctionDecl* function ) ...@@ -107,6 +109,19 @@ bool ParentBuilder::VisitFunctionDecl( const FunctionDecl* function )
return true; 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 ) void ParentBuilder::walk( const Stmt* stmt )
{ {
for( ConstStmtIterator it = stmt->child_begin(); for( ConstStmtIterator it = stmt->child_begin();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment