@@ -47,6 +47,17 @@ bool TreeVisitor::VisitTypedefDecl(clang::TypedefDecl *tpdef){
47
47
std::string name = tpdef->getName ();
48
48
std::string tpe = typeTranslator.Translate (tpdef->getUnderlyingType ());
49
49
declarations += " \t type " + name + " = " + tpe + " \n " ;
50
+
51
+ cycleDetection.AddDependcy (name, tpdef->getUnderlyingType ());
52
+ if (cycleDetection.isCyclic (name)){
53
+ llvm::errs () << " Error: " << name << " ic cyclic\n " ;
54
+ llvm::errs () << name << " \n " ;
55
+ for (auto & s : cycleDetection.dependencies [name]){
56
+ llvm::errs () << " \t " << s << " \n " ;
57
+ }
58
+ llvm::errs () << cycleDetection.isCyclic (name) << " \n " ;
59
+ }
60
+
50
61
return true ;
51
62
}
52
63
@@ -145,11 +156,16 @@ bool TreeVisitor::VisitRecordDecl(clang::RecordDecl *record){
145
156
fields = fields.substr (0 , fields.size ()-2 );
146
157
}
147
158
148
- // llvm::errs() << newName << "\n";
149
- // for(auto& s : cycleDetection.dependencies[newName]){
150
- // llvm::errs() << "\t" << s << "\n";
151
- // }
152
- // llvm::errs() << cycleDetection.isCyclic(newName) << "\n";
159
+
160
+
161
+ if (cycleDetection.isCyclic (newName)){
162
+ llvm::errs () << " Error: " << newName << " ic cyclic\n " ;
163
+ llvm::errs () << newName << " \n " ;
164
+ for (auto & s : cycleDetection.dependencies [newName]){
165
+ llvm::errs () << " \t " << s << " \n " ;
166
+ }
167
+ llvm::errs () << cycleDetection.isCyclic (newName) << " \n " ;
168
+ }
153
169
154
170
if (fieldCnt < SCALA_NATIVE_MAX_STRUCT_FIELDS){
155
171
declarations += " \t type " + newName + " = " + " native.CStruct" + std::to_string (fieldCnt) + " [" + fields + " ]\n " ;
0 commit comments