From: Michal Sojka Date: Thu, 26 Jul 2012 21:56:50 +0000 (+0200) Subject: Replace magic constants with something better - not finished X-Git-Url: http://rtime.felk.cvut.cz/gitweb/boost-statechart-viewer.git/commitdiff_plain/875a4d6421a79c3a7e9a444846cb39bccbfcb7d1 Replace magic constants with something better - not finished --- diff --git a/src/visualizer.cpp b/src/visualizer.cpp index b15919d..7112611 100644 --- a/src/visualizer.cpp +++ b/src/visualizer.cpp @@ -183,7 +183,7 @@ class FindStates : public ASTConsumer loc = decl->getLocation(); if(loc.isValid()) { - if(decl->getKind()==35) + if(dyn_cast(decl)) { method_decl(decl); } @@ -221,7 +221,7 @@ class FindStates : public ASTConsumer loc = decl->getLocation(); if(loc.isValid()) { - if(decl->getKind()==35) + if(dyn_cast(decl)) { method_decl(decl); } @@ -331,7 +331,7 @@ class FindStates : public ASTConsumer output=""; } } - if(i->getKind()==35) method_decl(*i);// C++ method + if (dyn_cast(*i)) method_decl(*i);// C++ method } } @@ -341,17 +341,17 @@ class FindStates : public ASTConsumer */ void method_decl(const Decl *decl) { + const FunctionDecl *fDecl = dyn_cast(decl); string output, line, event; llvm::raw_string_ostream x(output); - if(decl->hasBody()) + if(fDecl->hasBody() && fDecl->getNumParams() > 0) { decl->print(x); line = get_return(x.str()); if(get_model(line)==5) { //std::cout<<"metodass"<(decl); const ParmVarDecl *pvd = fDecl->getParamDecl(0); QualType qt = pvd->getOriginalType(); event = qt.getAsString();