@@ -69,7 +69,7 @@ class AddDebugInfoPass : public fir::impl::AddDebugInfoBase<AddDebugInfoPass> {
6969 const std::string &name, mlir::LLVM::DIFileAttr fileAttr,
7070 mlir::LLVM::DIScopeAttr scope, unsigned line, bool decl);
7171 mlir::LLVM::DICommonBlockAttr
72- getOrCreateCommonBlockAttr (const std::string & name,
72+ getOrCreateCommonBlockAttr (llvm::StringRef name,
7373 mlir::LLVM::DIFileAttr fileAttr,
7474 mlir::LLVM::DIScopeAttr scope, unsigned line);
7575
@@ -112,7 +112,7 @@ bool AddDebugInfoPass::createCommonBlockGlobal(
112112 mlir::MLIRContext *context = &getContext ();
113113 mlir::OpBuilder builder (context);
114114 std::optional<std::int64_t > optint;
115- auto op = declOp.getMemref ().getDefiningOp ();
115+ mlir::Operation * op = declOp.getMemref ().getDefiningOp ();
116116
117117 if (auto conOp = mlir::dyn_cast_if_present<fir::ConvertOp>(op))
118118 op = conOp.getValue ().getDefiningOp ();
@@ -126,20 +126,20 @@ bool AddDebugInfoPass::createCommonBlockGlobal(
126126 op = conOp2.getValue ().getDefiningOp ();
127127
128128 if (auto addrOfOp = mlir::dyn_cast_if_present<fir::AddrOfOp>(op)) {
129- auto sym = addrOfOp.getSymbol ();
129+ mlir::SymbolRefAttr sym = addrOfOp.getSymbol ();
130130 if (auto global =
131131 symbolTable->lookup <fir::GlobalOp>(sym.getRootReference ())) {
132132
133133 unsigned line = getLineFromLoc (global.getLoc ());
134- std::string commonName (sym.getRootReference ().str ());
134+ llvm::StringRef commonName (sym.getRootReference ().str ());
135135 // FIXME: We are trying to extract the name of the common block from the
136136 // name of the global. As part of mangling, GetCommonBlockObjectName can
137137 // add a trailing _ in the name of that global. The demangle function
138138 // does not seem to handle such cases. So the following hack is used to
139139 // remove the trailing '_'.
140140 if (commonName != Fortran::common::blankCommonObjectName &&
141141 commonName.back () == ' _' )
142- commonName. pop_back ();
142+ commonName = commonName. drop_back ();
143143 mlir::LLVM::DICommonBlockAttr commonBlock =
144144 getOrCreateCommonBlockAttr (commonName, fileAttr, scopeAttr, line);
145145 mlir::LLVM::DITypeAttr diType = typeGen.convertType (
@@ -218,7 +218,7 @@ void AddDebugInfoPass::handleDeclareOp(fir::cg::XDeclareOp declOp,
218218}
219219
220220mlir::LLVM::DICommonBlockAttr AddDebugInfoPass::getOrCreateCommonBlockAttr (
221- const std::string & name, mlir::LLVM::DIFileAttr fileAttr,
221+ llvm::StringRef name, mlir::LLVM::DIFileAttr fileAttr,
222222 mlir::LLVM::DIScopeAttr scope, unsigned line) {
223223 mlir::MLIRContext *context = &getContext ();
224224 mlir::LLVM::DICommonBlockAttr cbAttr;
0 commit comments