]> rtime.felk.cvut.cz Git - boost-statechart-viewer.git/commitdiff
Event typedef missing
authorPetr Silhavik <silhavik.p@gmail.com>
Thu, 27 Dec 2012 18:06:16 +0000 (19:06 +0100)
committerPetr Silhavik <silhavik.p@gmail.com>
Thu, 27 Dec 2012 18:06:16 +0000 (19:06 +0100)
When typedef for reactions is missing then warning is generated.

src/visualizer.cpp

index 22db6669590d4a9225eba2dc9c9d0625831c3309..8a39b55442b21eb4623ec761942c4f4d84e28768 100644 (file)
@@ -407,6 +407,7 @@ public:
 
     void handleSimpleState(CXXRecordDecl *RecordDecl, const CXXBaseSpecifier *Base)
     {
+       int typedef_num = 0;
        string name(RecordDecl->getName()); //getQualifiedNameAsString());
        Diag(RecordDecl->getLocStart(), diag_found_state) << name;
 
@@ -446,7 +447,14 @@ public:
        // TODO: Find when state has no reactions
        for (DeclContext::lookup_result Reactions = RecordDecl->lookup(DeclarationName(&II));
             Reactions.first != Reactions.second; ++Reactions.first)
-           HandleReaction(*Reactions.first, RecordDecl);
+       {           
+               HandleReaction(*Reactions.first, RecordDecl);
+               typedef_num++;
+       }
+       if(typedef_num == 0) {
+               Diag(RecordDecl->getLocStart(), diag_warning)
+                   << " missing typedef for reactions in state : " << RecordDecl->getName();
+       }
     }
 
     void handleStateMachine(CXXRecordDecl *RecordDecl, const CXXBaseSpecifier *Base)