@@ -669,23 +669,30 @@ LogicalResult Context::convertCompilation() {
669669 for (auto *unit : root.compilationUnits ) {
670670 for (const auto &member : unit->members ()) {
671671 auto loc = convertLocation (member.location );
672- if (failed (member.visit (RootVisitor (*this , loc))))
672+ if (failed (member.visit (RootVisitor (*this , loc)))) {
673+ dbgs (loc) << " Failed to convert top-level object " << member.name ;
673674 return failure ();
675+ }
674676 }
675677 }
676678
677679 // Prime the root definition worklist by adding all the top-level modules.
678680 SmallVector<const slang::ast::InstanceSymbol *> topInstances;
679681 for (auto *inst : root.topInstances )
680- if (!convertModuleHeader (&inst->body ))
682+ if (!convertModuleHeader (&inst->body )) {
683+ dbgs (inst->location ) << " : Failed to convert module header of module "
684+ << inst->name ;
681685 return failure ();
682-
686+ }
683687 // Convert all the root module definitions.
684688 while (!moduleWorklist.empty ()) {
685689 auto *module = moduleWorklist.front ();
686690 moduleWorklist.pop ();
687- if (failed (convertModuleBody (module )))
691+ if (failed (convertModuleBody (module ))) {
692+ dbgs (module ->location )
693+ << " : Failed to convert module body of module " << module ->name ;
688694 return failure ();
695+ }
689696 }
690697
691698 return success ();
@@ -1057,8 +1064,10 @@ Context::convertFunction(const slang::ast::SubroutineSymbol &subroutine) {
10571064
10581065 // First get or create the function declaration.
10591066 auto *lowering = declareFunction (subroutine);
1060- if (!lowering)
1067+ if (!lowering) {
1068+ dbgs (subroutine.location ) << " Failed to lower function " << subroutine.name ;
10611069 return failure ();
1070+ }
10621071 ValueSymbolScope scope (valueSymbols);
10631072
10641073 // Create a function body block and populate it with block arguments.
@@ -1101,9 +1110,11 @@ Context::convertFunction(const slang::ast::SubroutineSymbol &subroutine) {
11011110 valueSymbols.insert (subroutine.returnValVar , returnVar);
11021111 }
11031112
1104- if (failed (convertStatement (subroutine.getBody ())))
1113+ if (failed (convertStatement (subroutine.getBody ()))) {
1114+ dbgs (subroutine.location )
1115+ << " Failed to convert body of function " << subroutine.name ;
11051116 return failure ();
1106-
1117+ }
11071118 // If there was no explicit return statement provided by the user, insert a
11081119 // default one.
11091120 if (builder.getBlock ()) {
0 commit comments