Skip to content

Commit 94aecb0

Browse files
committed
Replace 'hasInitializationBody' with 'isInitialized'.
This address one of the review comments.
1 parent e837cab commit 94aecb0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

flang/lib/Optimizer/Transforms/AddDebugInfo.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void AddDebugInfoPass::handleGlobalOp(fir::GlobalOp globalOp,
148148
// of a corresponding module body).
149149
// But in practice, compilers use declaration attribute with a module in cases
150150
// where module was defined in another source file (only being used in this
151-
// one). The hasInitializationBody() seems to provide the right information
151+
// one). The isInitialized() seems to provide the right information
152152
// but inverted. It is true where module is actually defined but false where
153153
// it is used.
154154
// FIXME: Currently we don't have the line number on which a module was
@@ -159,15 +159,15 @@ void AddDebugInfoPass::handleGlobalOp(fir::GlobalOp globalOp,
159159
return;
160160

161161
scope = getOrCreateModuleAttr(result.second.modules[0], fileAttr, scope,
162-
line - 1, !globalOp.hasInitializationBody());
162+
line - 1, !globalOp.isInitialized());
163163

164164
auto diType = typeGen.convertType(globalOp.getType(), fileAttr, scope,
165165
globalOp.getLoc());
166166
auto gvAttr = mlir::LLVM::DIGlobalVariableAttr::get(
167167
context, scope, mlir::StringAttr::get(context, result.second.name),
168168
mlir::StringAttr::get(context, globalOp.getName()), fileAttr, line,
169169
diType, /*isLocalToUnit*/ false,
170-
/*isDefinition*/ globalOp.hasInitializationBody(), /* alignInBits*/ 0);
170+
/*isDefinition*/ globalOp.isInitialized(), /* alignInBits*/ 0);
171171
globalOp->setLoc(builder.getFusedLoc({globalOp->getLoc()}, gvAttr));
172172
}
173173

0 commit comments

Comments
 (0)