di-subprogram =: DebugTag[DISubprogram] diFileIndex[varint] - DIFileAttr lineNumber[varint] - unsigned nameIndex[varint] - StringAttr linkageNameIndex[varint] - StringAttr diCompileUnitIndex[varint] - DICompileUnitAttr scopeLine[varint] - unsigned
| 1018 | // diCompileUnitIndex[varint] - DICompileUnitAttr |
| 1019 | // scopeLine[varint] - unsigned |
| 1020 | LogicalResult parseDISubprogram(EncodingReader &reader, |
| 1021 | Attribute &diSubprogram) { |
| 1022 | auto file = readAndGetDebugInfo<DIFileAttr>(reader); |
| 1023 | if (!file) |
| 1024 | return reader.emitError() |
| 1025 | << "failed to read file attribute when parsing DISubprogramAttr"; |
| 1026 | |
| 1027 | uint64_t line; |
| 1028 | if (failed(reader.readVarInt(line))) |
| 1029 | return reader.emitError() |
| 1030 | << "failed to read line number when parsing DISubprogramAttr"; |
| 1031 | |
| 1032 | StringRef nameStr; |
| 1033 | if (failed(reader.readAndGetString(nameStr))) |
| 1034 | return reader.emitError() |
| 1035 | << "failed to read name attribute when parsing DISubprogramAttr"; |
| 1036 | StringAttr name = StringAttr::get(&context, nameStr); |
| 1037 | |
| 1038 | StringRef linkageNameStr; |
| 1039 | if (failed(reader.readAndGetString(linkageNameStr))) |
| 1040 | return reader.emitError() << "failed to read linkage name attribute when " |
| 1041 | "parsing DISubprogramAttr"; |
| 1042 | StringAttr linkageName = StringAttr::get(&context, linkageNameStr); |
| 1043 | |
| 1044 | auto compileUnit = readAndGetDebugInfo<DICompileUnitAttr>(reader); |
| 1045 | if (!compileUnit) |
| 1046 | return reader.emitError() << "failed to read compile unit attribute when " |
| 1047 | "parsing DISubprogramAttr"; |
| 1048 | |
| 1049 | uint64_t scopeLine; |
| 1050 | if (failed(reader.readVarInt(scopeLine))) |
| 1051 | return reader.emitError() << "failed to read scope line number when " |
| 1052 | "parsing DISubprogramAttr"; |
| 1053 | |
| 1054 | diSubprogram = DISubprogramAttr::get(&context, file, line, name, |
| 1055 | linkageName, compileUnit, scopeLine); |
| 1056 | return success(); |
| 1057 | } |
| 1058 | |
| 1059 | // call-site =: |
| 1060 | // DebugTag[CallSite] |
nothing calls this directly
no test coverage detected