]> rtime.felk.cvut.cz Git - boost-statechart-viewer.git/commitdiff
Corrected Makefile(wrong name of the source file) and updated visualizer.cpp Now...
authorsilhape2 <silhape2@postel.local>
Tue, 15 Feb 2011 09:27:15 +0000 (10:27 +0100)
committersilhape2 <silhape2@postel.local>
Tue, 15 Feb 2011 09:27:15 +0000 (10:27 +0100)
Makefile
visualizer.cpp

index 35aabed7b9ee7831d5d2c3b972aa7cffbe7dd8ca..bc774c04055d5c5211d062ba287de53e0bac95ab 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ LLVM_BIN= $(CURDIR)/_install/bin
 
 LLVM_CONFIG := $(shell $(LLVM_BIN)/llvm-config --cxxflags --ldflags --libs jit core)
 
-g++ : main.cpp
+g++ : visualizer.cpp
        g++ visualizer.cpp -o visualizer -g -lclangParse -lclangFrontend -lclangSerialization \
        -lclangDriver -lclangCodeGen -lclangSema -lclangChecker \
        -lclangAnalysis -lclangRewrite -lclangAST -lclangLex -lclangBasic \
index 8bafb1ec2333e8a29dc4a8efabc6db4701d39c9b..5d7e942615c0e0353e2639d11e411d1c4a39ea86 100644 (file)
@@ -89,9 +89,10 @@ class FindStates : public ASTConsumer
                                                        {                               
                                                                const CXXRecordDecl *cRecDecl = dyn_cast<CXXRecordDecl>(decl);
                                                                if(cRecDecl->getNumBases()==1) //state is derived from one base class simple_state              
-                                                               {                                                       
+                                                               {       
+                                                                       const DeclContext *declCont = tagDecl->castToDeclContext(tagDecl);                                              
                                                                        std::cout << "New state: " << namedDecl->getNameAsString() << "\n";
-                                                                       find_transitions(namedDecl->getNameAsString(), cRecDecl);
+                                                                       find_transitions(namedDecl->getNameAsString(), declCont);
                                                                }
                                                        }
                                                }
@@ -101,25 +102,30 @@ class FindStates : public ASTConsumer
                }
        }
 
-       void find_transitions (const std::string name_of_state, const CXXRecordDecl *cRecDecl) // traverse all methods for finding declarations of transitions
+       void find_transitions (const std::string name_of_state,const DeclContext *declCont) // traverse all methods for finding declarations of transitions
        {       
                std::string output, line, event, dest, params;  
                llvm::raw_string_ostream x(output);
                int pos;                
-               for (CXXRecordDecl::my_iterator i = cRecDecl->it_begin(), e = cRecDecl->it_end(); i != e; ++i) 
+               for (DeclContext::decl_iterator i = declCont->decls_begin(), e = declCont->decls_end(); i != e; ++i) 
                {
-                       const Decl *decl = *i;  
-                       const NamedDecl *namedDecl = dyn_cast<NamedDecl>(decl);
-                       decl->print(x);
-                       output = x.str();
-                       if(count(output)==1)
+                       const Decl *decl = *i;
+                       //decl->dump();
+                       
+                       if (const TypedefDecl *typeDecl = llvm::dyn_cast<TypedefDecl>(decl)) 
                        {
-                               line = clean_spaces(cut_typedef(output));
-                               params = get_transition_params(line);
-                               pos = params.find(",");
-                               event = params.substr(0,pos);
-                               dest = params.substr(pos+1);
-                               if(is_transition(line)) std::cout << "New transition: " << name_of_state<<" -> "<<event<<" -> "<< dest<<"\n";
+                               const NamedDecl *namedDecl = dyn_cast<NamedDecl>(decl);
+                               decl->print(x);
+                               output = x.str();
+                               if(count(output)==1)
+                               {
+                                       line = clean_spaces(cut_typedef(output));
+                                       params = get_transition_params(line);
+                                       pos = params.find(",");
+                                       event = params.substr(0,pos);
+                                       dest = params.substr(pos+1);
+                                       if(is_transition(line)) std::cout << "New transition: " << name_of_state<<" -> "<<event<<" -> "<< dest<<"\n";
+                               }
                        }
                        /* TODO else test na projiti*/
                }