11
11
// / This pass populates some debug information for the module and functions.
12
12
// ===----------------------------------------------------------------------===//
13
13
14
- #include " DebugTypeGenerator.h"
15
14
#include " flang/Common/Version.h"
16
15
#include " flang/Optimizer/Builder/FIRBuilder.h"
17
16
#include " flang/Optimizer/Builder/Todo.h"
@@ -107,27 +106,14 @@ void AddDebugInfoPass::runOnOperation() {
107
106
filePath = llvm::sys::path::parent_path (funcLoc.getFilename ().getValue ());
108
107
}
109
108
110
- mlir::StringAttr fullName =
111
- mlir::StringAttr::get (context, funcOp.getName ());
112
- auto result = fir::NameUniquer::deconstruct (funcOp.getName ());
113
109
mlir::StringAttr funcName =
114
- mlir::StringAttr::get (context, result.second .name );
115
-
116
- llvm::SmallVector<mlir::LLVM::DITypeAttr> types;
117
- fir::DebugTypeGenerator typeGen (module );
118
- for (auto resTy : funcOp.getResultTypes ()) {
119
- auto tyAttr =
120
- typeGen.convertType (resTy, fileAttr, cuAttr, funcOp.getLoc ());
121
- types.push_back (tyAttr);
122
- }
123
- for (auto inTy : funcOp.getArgumentTypes ()) {
124
- auto tyAttr = typeGen.convertType (fir::unwrapRefType (inTy), fileAttr,
125
- cuAttr, funcOp.getLoc ());
126
- types.push_back (tyAttr);
127
- }
128
-
110
+ mlir::StringAttr::get (context, funcOp.getName ());
111
+ mlir::LLVM::DIBasicTypeAttr bT = mlir::LLVM::DIBasicTypeAttr::get (
112
+ context, llvm::dwarf::DW_TAG_base_type, " void" , /* sizeInBits=*/ 0 ,
113
+ /* encoding=*/ 1 );
114
+ // FIXME: Provide proper type for subroutine
129
115
mlir::LLVM::DISubroutineTypeAttr subTypeAttr =
130
- mlir::LLVM::DISubroutineTypeAttr::get (context, CC, types );
116
+ mlir::LLVM::DISubroutineTypeAttr::get (context, CC, {bT, bT} );
131
117
mlir::LLVM::DIFileAttr funcFileAttr =
132
118
mlir::LLVM::DIFileAttr::get (context, fileName, filePath);
133
119
@@ -144,13 +130,11 @@ void AddDebugInfoPass::runOnOperation() {
144
130
subprogramFlags =
145
131
subprogramFlags | mlir::LLVM::DISubprogramFlags::Definition;
146
132
}
147
- unsigned line = 1 ;
148
- if (auto funcLoc = l.dyn_cast <mlir::FileLineColLoc>())
149
- line = funcLoc.getLine ();
150
-
133
+ // FIXME: Provide proper line and scopeline.
151
134
auto spAttr = mlir::LLVM::DISubprogramAttr::get (
152
- context, id, compilationUnit, fileAttr, funcName, fullName,
153
- funcFileAttr, line, line, subprogramFlags, subTypeAttr);
135
+ context, id, compilationUnit, fileAttr, funcName, funcName,
136
+ funcFileAttr, /* line=*/ 1 , /* scopeline=*/ 1 , subprogramFlags,
137
+ subTypeAttr);
154
138
funcOp->setLoc (builder.getFusedLoc ({funcOp->getLoc ()}, spAttr));
155
139
});
156
140
}
0 commit comments