Skip to content

Commit 743681c

Browse files
committed
Addressed review comments.
1. Skip variables if module list is empty. 2. Add a missing line at the end of a file.
1 parent d7322ba commit 743681c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

flang/lib/Optimizer/Transforms/AddDebugInfo.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,11 @@ void AddDebugInfoPass::handleGlobalOp(fir::GlobalOp globalOp,
155155
// declared. We are using a best guess of line - 1 where line is the source
156156
// line of the first member of the module that we encounter.
157157

158-
if (!result.second.modules.empty())
159-
scope = getOrCreateModuleAttr(result.second.modules[0], fileAttr, scope,
160-
line - 1, !globalOp.hasInitializationBody());
158+
if (result.second.modules.empty())
159+
return;
160+
161+
scope = getOrCreateModuleAttr(result.second.modules[0], fileAttr, scope,
162+
line - 1, !globalOp.hasInitializationBody());
161163

162164
auto diType = typeGen.convertType(globalOp.getType(), fileAttr, scope,
163165
globalOp.getLoc());

flang/test/Transforms/debug-module-1.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ end program test
3636

3737
! CHECK-DAG: loc(fused<#[[GLR]]>[#[[LOC1]]])
3838
! CHECK-DAG: loc(fused<#[[GLI]]>[#[[LOC2]]])
39-
! CHECK-DAG: loc(fused<#[[TEST]]>[#[[LOC3]]])
39+
! CHECK-DAG: loc(fused<#[[TEST]]>[#[[LOC3]]])

0 commit comments

Comments
 (0)