diff options
Diffstat (limited to 'llvm/lib')
58 files changed, 1169 insertions, 1173 deletions
diff --git a/llvm/lib/Analysis/ModuleDebugInfoPrinter.cpp b/llvm/lib/Analysis/ModuleDebugInfoPrinter.cpp index 7ee2f9d6e59..36c47141a45 100644 --- a/llvm/lib/Analysis/ModuleDebugInfoPrinter.cpp +++ b/llvm/lib/Analysis/ModuleDebugInfoPrinter.cpp @@ -72,7 +72,7 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const { // Printing the nodes directly isn't particularly helpful (since they // reference other nodes that won't be printed, particularly for the // filenames), so just print a few useful things. - for (MDCompileUnit *CU : Finder.compile_units()) { + for (DICompileUnit *CU : Finder.compile_units()) { O << "Compile unit: "; if (const char *Lang = dwarf::LanguageString(CU->getSourceLanguage())) O << Lang; @@ -82,7 +82,7 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const { O << '\n'; } - for (MDSubprogram *S : Finder.subprograms()) { + for (DISubprogram *S : Finder.subprograms()) { O << "Subprogram: " << S->getName(); printFile(O, S->getFilename(), S->getDirectory(), S->getLine()); if (!S->getLinkageName().empty()) @@ -90,7 +90,7 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const { O << '\n'; } - for (const MDGlobalVariable *GV : Finder.global_variables()) { + for (const DIGlobalVariable *GV : Finder.global_variables()) { O << "Global variable: " << GV->getName(); printFile(O, GV->getFilename(), GV->getDirectory(), GV->getLine()); if (!GV->getLinkageName().empty()) @@ -98,12 +98,12 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const { O << '\n'; } - for (const MDType *T : Finder.types()) { + for (const DIType *T : Finder.types()) { O << "Type:"; if (!T->getName().empty()) O << ' ' << T->getName(); printFile(O, T->getFilename(), T->getDirectory(), T->getLine()); - if (auto *BT = dyn_cast<MDBasicType>(T)) { + if (auto *BT = dyn_cast<DIBasicType>(T)) { O << " "; if (const char *Encoding = dwarf::AttributeEncodingString(BT->getEncoding())) @@ -117,7 +117,7 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const { else O << "unknown-tag(" << T->getTag() << ")"; } - if (auto *CT = dyn_cast<MDCompositeType>(T)) { + if (auto *CT = dyn_cast<DICompositeType>(T)) { if (auto *S = CT->getRawIdentifier()) O << " (identifier: '" << S->getString() << "')"; } diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 172f3092048..1a2e1f85e81 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -2994,7 +2994,7 @@ bool LLParser::ParseMDTuple(MDNode *&MD, bool IsDistinct) { /// MDNode: /// ::= !{ ... } /// ::= !7 -/// ::= !MDLocation(...) +/// ::= !DILocation(...) bool LLParser::ParseMDNode(MDNode *&N) { if (Lex.getKind() == lltok::MetadataVar) return ParseSpecializedMDNode(N); @@ -3209,7 +3209,7 @@ bool LLParser::ParseMDField(LocTy Loc, StringRef Name, DIFlagField &Result) { if (Lex.getKind() != lltok::DIFlag) return TokError("expected debug info flag"); - Val = DebugNode::getFlag(Lex.getStrVal()); + Val = DINode::getFlag(Lex.getStrVal()); if (!Val) return TokError(Twine("invalid debug info flag flag '") + Lex.getStrVal() + "'"); @@ -3391,9 +3391,9 @@ bool LLParser::ParseSpecializedMDNode(MDNode *&N, bool IsDistinct) { #define GET_OR_DISTINCT(CLASS, ARGS) \ (IsDistinct ? CLASS::getDistinct ARGS : CLASS::get ARGS) -/// ParseMDLocationFields: -/// ::= !MDLocation(line: 43, column: 8, scope: !5, inlinedAt: !6) -bool LLParser::ParseMDLocation(MDNode *&Result, bool IsDistinct) { +/// ParseDILocationFields: +/// ::= !DILocation(line: 43, column: 8, scope: !5, inlinedAt: !6) +bool LLParser::ParseDILocation(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ OPTIONAL(line, LineField, ); \ OPTIONAL(column, ColumnField, ); \ @@ -3403,13 +3403,13 @@ bool LLParser::ParseMDLocation(MDNode *&Result, bool IsDistinct) { #undef VISIT_MD_FIELDS Result = GET_OR_DISTINCT( - MDLocation, (Context, line.Val, column.Val, scope.Val, inlinedAt.Val)); + DILocation, (Context, line.Val, column.Val, scope.Val, inlinedAt.Val)); return false; } -/// ParseGenericDebugNode: -/// ::= !GenericDebugNode(tag: 15, header: "...", operands: {...}) -bool LLParser::ParseGenericDebugNode(MDNode *&Result, bool IsDistinct) { +/// ParseGenericDINode: +/// ::= !GenericDINode(tag: 15, header: "...", operands: {...}) +bool LLParser::ParseGenericDINode(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(tag, DwarfTagField, ); \ OPTIONAL(header, MDStringField, ); \ @@ -3417,40 +3417,40 @@ bool LLParser::ParseGenericDebugNode(MDNode *&Result, bool IsDistinct) { PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(GenericDebugNode, + Result = GET_OR_DISTINCT(GenericDINode, (Context, tag.Val, header.Val, operands.Val)); return false; } -/// ParseMDSubrange: -/// ::= !MDSubrange(count: 30, lowerBound: 2) -bool LLParser::ParseMDSubrange(MDNode *&Result, bool IsDistinct) { +/// ParseDISubrange: +/// ::= !DISubrange(count: 30, lowerBound: 2) +bool LLParser::ParseDISubrange(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(count, MDSignedField, (-1, -1, INT64_MAX)); \ OPTIONAL(lowerBound, MDSignedField, ); PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDSubrange, (Context, count.Val, lowerBound.Val)); + Result = GET_OR_DISTINCT(DISubrange, (Context, count.Val, lowerBound.Val)); return false; } -/// ParseMDEnumerator: -/// ::= !MDEnumerator(value: 30, name: "SomeKind") -bool LLParser::ParseMDEnumerator(MDNode *&Result, bool IsDistinct) { +/// ParseDIEnumerator: +/// ::= !DIEnumerator(value: 30, name: "SomeKind") +bool LLParser::ParseDIEnumerator(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(name, MDStringField, ); \ REQUIRED(value, MDSignedField, ); PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDEnumerator, (Context, value.Val, name.Val)); + Result = GET_OR_DISTINCT(DIEnumerator, (Context, value.Val, name.Val)); return false; } -/// ParseMDBasicType: -/// ::= !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32) -bool LLParser::ParseMDBasicType(MDNode *&Result, bool IsDistinct) { +/// ParseDIBasicType: +/// ::= !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32) +bool LLParser::ParseDIBasicType(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ OPTIONAL(tag, DwarfTagField, (dwarf::DW_TAG_base_type)); \ OPTIONAL(name, MDStringField, ); \ @@ -3460,16 +3460,16 @@ bool LLParser::ParseMDBasicType(MDNode *&Result, bool IsDistinct) { PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDBasicType, (Context, tag.Val, name.Val, size.Val, + Result = GET_OR_DISTINCT(DIBasicType, (Context, tag.Val, name.Val, size.Val, align.Val, encoding.Val)); return false; } -/// ParseMDDerivedType: -/// ::= !MDDerivedType(tag: DW_TAG_pointer_type, name: "int", file: !0, +/// ParseDIDerivedType: +/// ::= !DIDerivedType(tag: DW_TAG_pointer_type, name: "int", file: !0, /// line: 7, scope: !1, baseType: !2, size: 32, /// align: 32, offset: 0, flags: 0, extraData: !3) -bool LLParser::ParseMDDerivedType(MDNode *&Result, bool IsDistinct) { +bool LLParser::ParseDIDerivedType(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(tag, DwarfTagField, ); \ OPTIONAL(name, MDStringField, ); \ @@ -3485,14 +3485,14 @@ bool LLParser::ParseMDDerivedType(MDNode *&Result, bool IsDistinct) { PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDDerivedType, + Result = GET_OR_DISTINCT(DIDerivedType, (Context, tag.Val, name.Val, file.Val, line.Val, scope.Val, baseType.Val, size.Val, align.Val, offset.Val, flags.Val, extraData.Val)); return false; } -bool LLParser::ParseMDCompositeType(MDNode *&Result, bool IsDistinct) { +bool LLParser::ParseDICompositeType(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(tag, DwarfTagField, ); \ OPTIONAL(name, MDStringField, ); \ @@ -3513,44 +3513,44 @@ bool LLParser::ParseMDCompositeType(MDNode *&Result, bool IsDistinct) { #undef VISIT_MD_FIELDS Result = GET_OR_DISTINCT( - MDCompositeType, + DICompositeType, (Context, tag.Val, name.Val, file.Val, line.Val, scope.Val, baseType.Val, size.Val, align.Val, offset.Val, flags.Val, elements.Val, runtimeLang.Val, vtableHolder.Val, templateParams.Val, identifier.Val)); return false; } -bool LLParser::ParseMDSubroutineType(MDNode *&Result, bool IsDistinct) { +bool LLParser::ParseDISubroutineType(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ OPTIONAL(flags, DIFlagField, ); \ REQUIRED(types, MDField, ); PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDSubroutineType, (Context, flags.Val, types.Val)); + Result = GET_OR_DISTINCT(DISubroutineType, (Context, flags.Val, types.Val)); return false; } -/// ParseMDFileType: -/// ::= !MDFileType(filename: "path/to/file", directory: "/path/to/dir") -bool LLParser::ParseMDFile(MDNode *&Result, bool IsDistinct) { +/// ParseDIFileType: +/// ::= !DIFileType(filename: "path/to/file", directory: "/path/to/dir") +bool LLParser::ParseDIFile(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(filename, MDStringField, ); \ REQUIRED(directory, MDStringField, ); PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDFile, (Context, filename.Val, directory.Val)); + Result = GET_OR_DISTINCT(DIFile, (Context, filename.Val, directory.Val)); return false; } -/// ParseMDCompileUnit: -/// ::= !MDCompileUnit(language: DW_LANG_C99, file: !0, producer: "clang", +/// ParseDICompileUnit: +/// ::= !DICompileUnit(language: DW_LANG_C99, file: !0, producer: "clang", /// isOptimized: true, flags: "-O2", runtimeVersion: 1, /// splitDebugFilename: "abc.debug", emissionKind: 1, /// enums: !1, retainedTypes: !2, subprograms: !3, /// globals: !4, imports: !5) -bool LLParser::ParseMDCompileUnit(MDNode *&Result, bool IsDistinct) { +bool LLParser::ParseDICompileUnit(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(language, DwarfLangField, ); \ REQUIRED(file, MDField, (/* AllowNull */ false)); \ @@ -3568,7 +3568,7 @@ bool LLParser::ParseMDCompileUnit(MDNode *&Result, bool IsDistinct) { PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDCompileUnit, + Result = GET_OR_DISTINCT(DICompileUnit, (Context, language.Val, file.Val, producer.Val, isOptimized.Val, flags.Val, runtimeVersion.Val, splitDebugFilename.Val, emissionKind.Val, enums.Val, @@ -3577,15 +3577,15 @@ bool LLParser::ParseMDCompileUnit(MDNode *&Result, bool IsDistinct) { return false; } -/// ParseMDSubprogram: -/// ::= !MDSubprogram(scope: !0, name: "foo", linkageName: "_Zfoo", +/// ParseDISubprogram: +/// ::= !DISubprogram(scope: !0, name: "foo", linkageName: "_Zfoo", /// file: !1, line: 7, type: !2, isLocal: false, /// isDefinition: true, scopeLine: 8, containingType: !3, /// virtuality: DW_VIRTUALTIY_pure_virtual, /// virtualIndex: 10, flags: 11, /// isOptimized: false, function: void ()* @_Z3foov, /// templateParams: !4, declaration: !5, variables: !6) -bool LLParser::ParseMDSubprogram(MDNode *&Result, bool IsDistinct) { +bool LLParser::ParseDISubprogram(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ OPTIONAL(scope, MDField, ); \ OPTIONAL(name, MDStringField, ); \ @@ -3609,7 +3609,7 @@ bool LLParser::ParseMDSubprogram(MDNode *&Result, bool IsDistinct) { #undef VISIT_MD_FIELDS Result = GET_OR_DISTINCT( - MDSubprogram, (Context, scope.Val, name.Val, linkageName.Val, file.Val, + DISubprogram, (Context, scope.Val, name.Val, linkageName.Val, file.Val, line.Val, type.Val, isLocal.Val, isDefinition.Val, scopeLine.Val, containingType.Val, virtuality.Val, virtualIndex.Val, flags.Val, isOptimized.Val, function.Val, @@ -3617,9 +3617,9 @@ bool LLParser::ParseMDSubprogram(MDNode *&Result, bool IsDistinct) { return false; } -/// ParseMDLexicalBlock: -/// ::= !MDLexicalBlock(scope: !0, file: !2, line: 7, column: 9) -bool LLParser::ParseMDLexicalBlock(MDNode *&Result, bool IsDistinct) { +/// ParseDILexicalBlock: +/// ::= !DILexicalBlock(scope: !0, file: !2, line: 7, column: 9) +bool LLParser::ParseDILexicalBlock(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(scope, MDField, (/* AllowNull */ false)); \ OPTIONAL(file, MDField, ); \ @@ -3629,13 +3629,13 @@ bool LLParser::ParseMDLexicalBlock(MDNode *&Result, bool IsDistinct) { #undef VISIT_MD_FIELDS Result = GET_OR_DISTINCT( - MDLexicalBlock, (Context, scope.Val, file.Val, line.Val, column.Val)); + DILexicalBlock, (Context, scope.Val, file.Val, line.Val, column.Val)); return false; } -/// ParseMDLexicalBlockFile: -/// ::= !MDLexicalBlockFile(scope: !0, file: !2, discriminator: 9) -bool LLParser::ParseMDLexicalBlockFile(MDNode *&Result, bool IsDistinct) { +/// ParseDILexicalBlockFile: +/// ::= !DILexicalBlockFile(scope: !0, file: !2, discriminator: 9) +bool LLParser::ParseDILexicalBlockFile(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(scope, MDField, (/* AllowNull */ false)); \ OPTIONAL(file, MDField, ); \ @@ -3643,14 +3643,14 @@ bool LLParser::ParseMDLexicalBlockFile(MDNode *&Result, bool IsDistinct) { PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDLexicalBlockFile, + Result = GET_OR_DISTINCT(DILexicalBlockFile, (Context, scope.Val, file.Val, discriminator.Val)); return false; } -/// ParseMDNamespace: -/// ::= !MDNamespace(scope: !0, file: !2, name: "SomeNamespace", line: 9) -bool LLParser::ParseMDNamespace(MDNode *&Result, bool IsDistinct) { +/// ParseDINamespace: +/// ::= !DINamespace(scope: !0, file: !2, name: "SomeNamespace", line: 9) +bool LLParser::ParseDINamespace(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(scope, MDField, ); \ OPTIONAL(file, MDField, ); \ @@ -3659,14 +3659,14 @@ bool LLParser::ParseMDNamespace(MDNode *&Result, bool IsDistinct) { PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDNamespace, + Result = GET_OR_DISTINCT(DINamespace, (Context, scope.Val, file.Val, name.Val, line.Val)); return false; } -/// ParseMDTemplateTypeParameter: -/// ::= !MDTemplateTypeParameter(name: "Ty", type: !1) -bool LLParser::ParseMDTemplateTypeParameter(MDNode *&Result, bool IsDistinct) { +/// ParseDITemplateTypeParameter: +/// ::= !DITemplateTypeParameter(name: "Ty", type: !1) +bool LLParser::ParseDITemplateTypeParameter(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ OPTIONAL(name, MDStringField, ); \ REQUIRED(type, MDField, ); @@ -3674,14 +3674,14 @@ bool LLParser::ParseMDTemplateTypeParameter(MDNode *&Result, bool IsDistinct) { #undef VISIT_MD_FIELDS Result = - GET_OR_DISTINCT(MDTemplateTypeParameter, (Context, name.Val, type.Val)); + GET_OR_DISTINCT(DITemplateTypeParameter, (Context, name.Val, type.Val)); return false; } -/// ParseMDTemplateValueParameter: -/// ::= !MDTemplateValueParameter(tag: DW_TAG_template_value_parameter, +/// ParseDITemplateValueParameter: +/// ::= !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, /// name: "V", type: !1, value: i32 7) -bool LLParser::ParseMDTemplateValueParameter(MDNode *&Result, bool IsDistinct) { +bool LLParser::ParseDITemplateValueParameter(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ OPTIONAL(tag, DwarfTagField, (dwarf::DW_TAG_template_value_parameter)); \ OPTIONAL(name, MDStringField, ); \ @@ -3690,17 +3690,17 @@ bool LLParser::ParseMDTemplateValueParameter(MDNode *&Result, bool IsDistinct) { PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDTemplateValueParameter, + Result = GET_OR_DISTINCT(DITemplateValueParameter, (Context, tag.Val, name.Val, type.Val, value.Val)); return false; } -/// ParseMDGlobalVariable: -/// ::= !MDGlobalVariable(scope: !0, name: "foo", linkageName: "foo", +/// ParseDIGlobalVariable: +/// ::= !DIGlobalVariable(scope: !0, name: "foo", linkageName: "foo", /// file: !1, line: 7, type: !2, isLocal: false, /// isDefinition: true, variable: i32* @foo, /// declaration: !3) -bool LLParser::ParseMDGlobalVariable(MDNode *&Result, bool IsDistinct) { +bool LLParser::ParseDIGlobalVariable(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(name, MDStringField, (/* AllowEmpty */ false)); \ OPTIONAL(scope, MDField, ); \ @@ -3715,17 +3715,17 @@ bool LLParser::ParseMDGlobalVariable(MDNode *&Result, bool IsDistinct) { PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDGlobalVariable, + Result = GET_OR_DISTINCT(DIGlobalVariable, (Context, scope.Val, name.Val, linkageName.Val, file.Val, line.Val, type.Val, isLocal.Val, isDefinition.Val, variable.Val, declaration.Val)); return false; } -/// ParseMDLocalVariable: -/// ::= !MDLocalVariable(tag: DW_TAG_arg_variable, scope: !0, name: "foo", +/// ParseDILocalVariable: +/// ::= !DILocalVariable(tag: DW_TAG_arg_variable, scope: !0, name: "foo", /// file: !1, line: 7, type: !2, arg: 2, flags: 7) -bool LLParser::ParseMDLocalVariable(MDNode *&Result, bool IsDistinct) { +bool LLParser::ParseDILocalVariable(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(tag, DwarfTagField, ); \ REQUIRED(scope, MDField, (/* AllowNull */ false)); \ @@ -3738,15 +3738,15 @@ bool LLParser::ParseMDLocalVariable(MDNode *&Result, bool IsDistinct) { PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDLocalVariable, + Result = GET_OR_DISTINCT(DILocalVariable, (Context, tag.Val, scope.Val, name.Val, file.Val, line.Val, type.Val, arg.Val, flags.Val)); return false; } -/// ParseMDExpression: -/// ::= !MDExpression(0, 7, -1) -bool LLParser::ParseMDExpression(MDNode *&Result, bool IsDistinct) { +/// ParseDIExpression: +/// ::= !DIExpression(0, 7, -1) +bool LLParser::ParseDIExpression(MDNode *&Result, bool IsDistinct) { assert(Lex.getKind() == lltok::MetadataVar && "Expected metadata type name"); Lex.Lex(); @@ -3778,14 +3778,14 @@ bool LLParser::ParseMDExpression(MDNode *&Result, bool IsDistinct) { if (ParseToken(lltok::rparen, "expected ')' here")) return true; - Result = GET_OR_DISTINCT(MDExpression, (Context, Elements)); + Result = GET_OR_DISTINCT(DIExpression, (Context, Elements)); return false; } -/// ParseMDObjCProperty: -/// ::= !MDObjCProperty(name: "foo", file: !1, line: 7, setter: "setFoo", +/// ParseDIObjCProperty: +/// ::= !DIObjCProperty(name: "foo", file: !1, line: 7, setter: "setFoo", /// getter: "getFoo", attributes: 7, type: !2) -bool LLParser::ParseMDObjCProperty(MDNode *&Result, bool IsDistinct) { +bool LLParser::ParseDIObjCProperty(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ OPTIONAL(name, MDStringField, ); \ OPTIONAL(file, MDField, ); \ @@ -3797,16 +3797,16 @@ bool LLParser::ParseMDObjCProperty(MDNode *&Result, bool IsDistinct) { PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDObjCProperty, + Result = GET_OR_DISTINCT(DIObjCProperty, (Context, name.Val, file.Val, line.Val, setter.Val, getter.Val, attributes.Val, type.Val)); return false; } -/// ParseMDImportedEntity: -/// ::= !MDImportedEntity(tag: DW_TAG_imported_module, scope: !0, entity: !1, +/// ParseDIImportedEntity: +/// ::= !DIImportedEntity(tag: DW_TAG_imported_module, scope: !0, entity: !1, /// line: 7, name: "foo") -bool LLParser::ParseMDImportedEntity(MDNode *&Result, bool IsDistinct) { +bool LLParser::ParseDIImportedEntity(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(tag, DwarfTagField, ); \ REQUIRED(scope, MDField, ); \ @@ -3816,7 +3816,7 @@ bool LLParser::ParseMDImportedEntity(MDNode *&Result, bool IsDistinct) { PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(MDImportedEntity, (Context, tag.Val, scope.Val, + Result = GET_OR_DISTINCT(DIImportedEntity, (Context, tag.Val, scope.Val, entity.Val, line.Val, name.Val)); return false; } @@ -3871,7 +3871,7 @@ bool LLParser::ParseValueAsMetadata(Metadata *&MD, const Twine &TypeMsg, /// ::= !42 /// ::= !{...} /// ::= !"string" -/// ::= !MDLocation(...) +/// ::= !DILocation(...) bool LLParser::ParseMetadata(Metadata *&MD, PerFunctionState *PFS) { if (Lex.getKind() == lltok::MetadataVar) { MDNode *N; diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index b76b134b760..565e46bd820 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1724,7 +1724,7 @@ std::error_code BitcodeReader::ParseMetadata() { Metadata *InlinedAt = Record[4] ? MDValueList.getValueFwdRef(Record[4] - 1) : nullptr; MDValueList.AssignValue( - GET_OR_DISTINCT(MDLocation, Record[0], + GET_OR_DISTINCT(DILocation, Record[0], (Context, Line, Column, Scope, InlinedAt)), NextMDValueNo++); break; @@ -1744,7 +1744,7 @@ std::error_code BitcodeReader::ParseMetadata() { for (unsigned I = 4, E = Record.size(); I != E; ++I) DwarfOps.push_back(Record[I] ? MDValueList.getValueFwdRef(Record[I] - 1) : nullptr); - MDValueList.AssignValue(GET_OR_DISTINCT(GenericDebugNode, Record[0], + MDValueList.AssignValue(GET_OR_DISTINCT(GenericDINode, Record[0], (Context, Tag, Header, DwarfOps)), NextMDValueNo++); break; @@ -1754,7 +1754,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDSubrange, Record[0], + GET_OR_DISTINCT(DISubrange, Record[0], (Context, Record[1], unrotateSign(Record[2]))), NextMDValueNo++); break; @@ -1763,7 +1763,7 @@ std::error_code BitcodeReader::ParseMetadata() { if (Record.size() != 3) return Error("Invalid record"); - MDValueList.AssignValue(GET_OR_DISTINCT(MDEnumerator, Record[0], + MDValueList.AssignValue(GET_OR_DISTINCT(DIEnumerator, Record[0], (Context, unrotateSign(Record[1]), getMDString(Record[2]))), NextMDValueNo++); @@ -1774,7 +1774,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDBasicType, Record[0], + GET_OR_DISTINCT(DIBasicType, Record[0], (Context, Record[1], getMDString(Record[2]), Record[3], Record[4], Record[5])), NextMDValueNo++); @@ -1785,7 +1785,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDDerivedType, Record[0], + GET_OR_DISTINCT(DIDerivedType, Record[0], (Context, Record[1], getMDString(Record[2]), getMDOrNull(Record[3]), Record[4], getMDOrNull(Record[5]), getMDOrNull(Record[6]), @@ -1799,7 +1799,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDCompositeType, Record[0], + GET_OR_DISTINCT(DICompositeType, Record[0], (Context, Record[1], getMDString(Record[2]), getMDOrNull(Record[3]), Record[4], getMDOrNull(Record[5]), getMDOrNull(Record[6]), @@ -1815,7 +1815,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDSubroutineType, Record[0], + GET_OR_DISTINCT(DISubroutineType, Record[0], (Context, Record[1], getMDOrNull(Record[2]))), NextMDValueNo++); break; @@ -1825,7 +1825,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDFile, Record[0], (Context, getMDString(Record[1]), + GET_OR_DISTINCT(DIFile, Record[0], (Context, getMDString(Record[1]), getMDString(Record[2]))), NextMDValueNo++); break; @@ -1835,7 +1835,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDCompileUnit, Record[0], + GET_OR_DISTINCT(DICompileUnit, Record[0], (Context, Record[1], getMDOrNull(Record[2]), getMDString(Record[3]), Record[4], getMDString(Record[5]), Record[6], @@ -1852,7 +1852,7 @@ std::error_code BitcodeReader::ParseMetadata() { MDValueList.AssignValue( GET_OR_DISTINCT( - MDSubprogram, Record[0], + DISubprogram, Record[0], (Context, getMDOrNull(Record[1]), getMDString(Record[2]), getMDString(Record[3]), getMDOrNull(Record[4]), Record[5], getMDOrNull(Record[6]), Record[7], Record[8], Record[9], @@ -1867,7 +1867,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDLexicalBlock, Record[0], + GET_OR_DISTINCT(DILexicalBlock, Record[0], (Context, getMDOrNull(Record[1]), getMDOrNull(Record[2]), Record[3], Record[4])), NextMDValueNo++); @@ -1878,7 +1878,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDLexicalBlockFile, Record[0], + GET_OR_DISTINCT(DILexicalBlockFile, Record[0], (Context, getMDOrNull(Record[1]), getMDOrNull(Record[2]), Record[3])), NextMDValueNo++); @@ -1889,7 +1889,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDNamespace, Record[0], + GET_OR_DISTINCT(DINamespace, Record[0], (Context, getMDOrNull(Record[1]), getMDOrNull(Record[2]), getMDString(Record[3]), Record[4])), @@ -1900,7 +1900,7 @@ std::error_code BitcodeReader::ParseMetadata() { if (Record.size() != 3) return Error("Invalid record"); - MDValueList.AssignValue(GET_OR_DISTINCT(MDTemplateTypeParameter, + MDValueList.AssignValue(GET_OR_DISTINCT(DITemplateTypeParameter, Record[0], (Context, getMDString(Record[1]), getMDOrNull(Record[2]))), @@ -1912,7 +1912,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDTemplateValueParameter, Record[0], + GET_OR_DISTINCT(DITemplateValueParameter, Record[0], (Context, Record[1], getMDString(Record[2]), getMDOrNull(Record[3]), getMDOrNull(Record[4]))), NextMDValueNo++); @@ -1923,7 +1923,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDGlobalVariable, Record[0], + GET_OR_DISTINCT(DIGlobalVariable, Record[0], (Context, getMDOrNull(Record[1]), getMDString(Record[2]), getMDString(Record[3]), getMDOrNull(Record[4]), Record[5], @@ -1938,7 +1938,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDLocalVariable, Record[0], + GET_OR_DISTINCT(DILocalVariable, Record[0], (Context, Record[1], getMDOrNull(Record[2]), getMDString(Record[3]), getMDOrNull(Record[4]), Record[5], getMDOrNull(Record[6]), Record[7], @@ -1951,7 +1951,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDExpression, Record[0], + GET_OR_DISTINCT(DIExpression, Record[0], (Context, makeArrayRef(Record).slice(1))), NextMDValueNo++); break; @@ -1961,7 +1961,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDObjCProperty, Record[0], + GET_OR_DISTINCT(DIObjCProperty, Record[0], (Context, getMDString(Record[1]), getMDOrNull(Record[2]), Record[3], getMDString(Record[4]), getMDString(Record[5]), @@ -1974,7 +1974,7 @@ std::error_code BitcodeReader::ParseMetadata() { return Error("Invalid record"); MDValueList.AssignValue( - GET_OR_DISTINCT(MDImportedEntity, Record[0], + GET_OR_DISTINCT(DIImportedEntity, Record[0], (Context, Record[1], getMDOrNull(Record[2]), getMDOrNull(Record[3]), Record[4], getMDString(Record[5]))), diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 15b0106ef54..85a6da33a6e 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -784,7 +784,7 @@ static void WriteMDTuple(const MDTuple *N, const ValueEnumerator &VE, Record.clear(); } -static void WriteMDLocation(const MDLocation *N, const ValueEnumerator &VE, +static void WriteDILocation(const DILocation *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) { @@ -798,11 +798,11 @@ static void WriteMDLocation(const MDLocation *N, const ValueEnumerator &VE, Record.clear(); } -static void WriteGenericDebugNode(const GenericDebugNode *N, - const ValueEnumerator &VE, - BitstreamWriter &Stream, - SmallVectorImpl<uint64_t> &Record, - unsigned Abbrev) { +static void WriteGenericDINode(const GenericDINode *N, + const ValueEnumerator &VE, + BitstreamWriter &Stream, + SmallVectorImpl<uint64_t> &Record, + unsigned Abbrev) { Record.push_back(N->isDistinct()); Record.push_back(N->getTag()); Record.push_back(0); // Per-tag version field; unused for now. @@ -819,7 +819,7 @@ static uint64_t rotateSign(int64_t I) { return I < 0 ? ~(U << 1) : U << 1; } -static void WriteMDSubrange(const MDSubrange *N, const ValueEnumerator &, +static void WriteDISubrange(const DISubrange *N, const ValueEnumerator &, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) { @@ -831,7 +831,7 @@ static void WriteMDSubrange(const MDSubrange *N, const ValueEnumerator &, Record.clear(); } -static void WriteMDEnumerator(const MDEnumerator *N, const ValueEnumerator &VE, +static void WriteDIEnumerator(const DIEnumerator *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) { @@ -843,7 +843,7 @@ static void WriteMDEnumerator(const MDEnumerator *N, const ValueEnumerator &VE, Record.clear(); } -static void WriteMDBasicType(const MDBasicType *N, const ValueEnumerator &VE, +static void WriteDIBasicType(const DIBasicType *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) { @@ -858,7 +858,7 @@ static void WriteMDBasicType(const MDBasicType *N, const ValueEnumerator &VE, Record.clear(); } -static void WriteMDDerivedType(const MDDerivedType *N, +static void WriteDIDerivedType(const DIDerivedType *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, @@ -880,7 +880,7 @@ static void WriteMDDerivedType(const MDDerivedType *N, Record.clear(); } -static void WriteMDCompositeType(const MDCompositeType *N, +static void WriteDICompositeType(const DICompositeType *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, @@ -906,7 +906,7 @@ static void WriteMDCompositeType(const MDCompositeType *N, Record.clear(); } -static void WriteMDSubroutineType(const MDSubroutineType *N, +static void WriteDISubroutineType(const DISubroutineType *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, @@ -919,7 +919,7 @@ static void WriteMDSubroutineType(const MDSubroutineType *N, Record.clear(); } -static void WriteMDFile(const MDFile *N, const ValueEnumerator &VE, +static void WriteDIFile(const DIFile *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) { Record.push_back(N->isDistinct()); @@ -930,7 +930,7 @@ static void WriteMDFile(const MDFile *N, const ValueEnumerator &VE, Record.clear(); } -static void WriteMDCompileUnit(const MDCompileUnit *N, +static void WriteDICompileUnit(const DICompileUnit *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, @@ -954,11 +954,10 @@ static void WriteMDCompileUnit(const MDCompileUnit *N, Record.clear(); } -static void WriteMDSubprogram(const MDSubprogram *N, - const ValueEnumerator &VE, - BitstreamWriter &Stream, - SmallVectorImpl<uint64_t> &Record, - unsigned Abbrev) { +static void WriteDISubprogram(const DISubprogram *N, const ValueEnumerator &VE, + BitstreamWriter &Stream, + SmallVectorImpl<uint64_t> &Record, + unsigned Abbrev) { Record.push_back(N->isDistinct()); Record.push_back(VE.getMetadataOrNullID(N->getScope())); Record.push_back(VE.getMetadataOrNullID(N->getRawName())); @@ -983,11 +982,11 @@ static void WriteMDSubprogram(const MDSubprogram *N, Record.clear(); } -static void WriteMDLexicalBlock(const MDLexicalBlock *N, - const ValueEnumerator &VE, - BitstreamWriter &Stream, - SmallVectorImpl<uint64_t> &Record, - unsigned Abbrev) { +static void WriteDILexicalBlock(const DILexicalBlock *N, + const ValueEnumerator &VE, + BitstreamWriter &Stream, + SmallVectorImpl<uint64_t> &Record, + unsigned Abbrev) { Record.push_back(N->isDistinct()); Record.push_back(VE.getMetadataOrNullID(N->getScope())); Record.push_back(VE.getMetadataOrNullID(N->getFile())); @@ -998,7 +997,7 @@ static void WriteMDLexicalBlock(const MDLexicalBlock *N, Record.clear(); } -static void WriteMDLexicalBlockFile(const MDLexicalBlockFile *N, +static void WriteDILexicalBlockFile(const DILexicalBlockFile *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, @@ -1012,7 +1011,7 @@ static void WriteMDLexicalBlockFile(const MDLexicalBlockFile *N, Record.clear(); } -static void WriteMDNamespace(const MDNamespace *N, const ValueEnumerator &VE, +static void WriteDINamespace(const DINamespace *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) { @@ -1026,7 +1025,7 @@ static void WriteMDNamespace(const MDNamespace *N, const ValueEnumerator &VE, Record.clear(); } -static void WriteMDTemplateTypeParameter(const MDTemplateTypeParameter *N, +static void WriteDITemplateTypeParameter(const DITemplateTypeParameter *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, @@ -1039,7 +1038,7 @@ static void WriteMDTemplateTypeParameter(const MDTemplateTypeParameter *N, Record.clear(); } -static void WriteMDTemplateValueParameter(const MDTemplateValueParameter *N, +static void WriteDITemplateValueParameter(const DITemplateValueParameter *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, @@ -1054,7 +1053,7 @@ static void WriteMDTemplateValueParameter(const MDTemplateValueParameter *N, Record.clear(); } -static void WriteMDGlobalVariable(const MDGlobalVariable *N, +static void WriteDIGlobalVariable(const DIGlobalVariable *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, @@ -1075,7 +1074,7 @@ static void WriteMDGlobalVariable(const MDGlobalVariable *N, Record.clear(); } -static void WriteMDLocalVariable(const MDLocalVariable *N, +static void WriteDILocalVariable(const DILocalVariable *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, @@ -1094,7 +1093,7 @@ static void WriteMDLocalVariable(const MDLocalVariable *N, Record.clear(); } -static void WriteMDExpression(const MDExpression *N, const ValueEnumerator &, +static void WriteDIExpression(const DIExpression *N, const ValueEnumerator &, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) { @@ -1107,11 +1106,11 @@ static void WriteMDExpression(const MDExpression *N, const ValueEnumerator &, Record.clear(); } -static void WriteMDObjCProperty(const MDObjCProperty *N, - const ValueEnumerator &VE, - BitstreamWriter &Stream, - SmallVectorImpl<uint64_t> &Record, - unsigned Abbrev) { +static void WriteDIObjCProperty(const DIObjCProperty *N, + const ValueEnumerator &VE, + BitstreamWriter &Stream, + SmallVectorImpl<uint64_t> &Record, + unsigned Abbrev) { Record.push_back(N->isDistinct()); Record.push_back(VE.getMetadataOrNullID(N->getRawName())); Record.push_back(VE.getMetadataOrNullID(N->getFile())); @@ -1125,7 +1124,7 @@ static void WriteMDObjCProperty(const MDObjCProperty *N, Record.clear(); } -static void WriteMDImportedEntity(const MDImportedEntity *N, +static void WriteDIImportedEntity(const DIImportedEntity *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl<uint64_t> &Record, @@ -1164,7 +1163,7 @@ static void WriteModuleMetadata(const Module *M, #define HANDLE_MDNODE_LEAF(CLASS) unsigned CLASS##Abbrev = 0; #include "llvm/IR/Metadata.def" - if (VE.hasMDLocation()) { + if (VE.hasDILocation()) { // Abbrev for METADATA_LOCATION. // // Assume the column is usually under 128, and always output the inlined-at @@ -1176,10 +1175,10 @@ static void WriteModuleMetadata(const Module *M, Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); - MDLocationAbbrev = Stream.EmitAbbrev(Abbv); + DILocationAbbrev = Stream.EmitAbbrev(Abbv); } - if (VE.hasGenericDebugNode()) { + if (VE.hasGenericDINode()) { // Abbrev for METADATA_GENERIC_DEBUG. // // Assume the column is usually under 128, and always output the inlined-at @@ -1192,7 +1191,7 @@ static void WriteModuleMetadata(const Module *M, Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); - GenericDebugNodeAbbrev = Stream.EmitAbbrev(Abbv); + GenericDINodeAbbrev = Stream.EmitAbbrev(Abbv); } unsigned NameAbbrev = 0; @@ -2105,7 +2104,7 @@ static void WriteFunction(const Function &F, ValueEnumerator &VE, bool NeedsMetadataAttachment = F.hasMetadata(); - MDLocation *LastDL = nullptr; + DILocation *LastDL = nullptr; // Finally, emit all the instructions, in order. for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB) @@ -2120,7 +2119,7 @@ static void WriteFunction(const Function &F, ValueEnumerator &VE, NeedsMetadataAttachment |= I->hasMetadataOtherThanDebugLoc(); // If the instruction has a debug location, emit it. - MDLocation *DL = I->getDebugLoc(); + DILocation *DL = I->getDebugLoc(); if (!DL) continue; diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp index 652851f4cc1..6c517f5ed8d 100644 --- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -285,7 +285,7 @@ static bool isIntOrIntVectorValue(const std::pair<const Value*, unsigned> &V) { ValueEnumerator::ValueEnumerator(const Module &M, bool ShouldPreserveUseListOrder) - : HasMDString(false), HasMDLocation(false), HasGenericDebugNode(false), + : HasMDString(false), HasDILocation(false), HasGenericDINode(false), ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) { if (ShouldPreserveUseListOrder) UseListOrders = predictUseListOrder(M); @@ -382,7 +382,7 @@ ValueEnumerator::ValueEnumerator(const Module &M, // Don't enumerate the location directly -- it has a special record // type -- but enumerate its operands. - if (MDLocation *L = I.getDebugLoc()) + if (DILocation *L = I.getDebugLoc()) EnumerateMDNodeOperands(L); } } @@ -548,8 +548,8 @@ void ValueEnumerator::EnumerateMetadata(const Metadata *MD) { EnumerateValue(C->getValue()); HasMDString |= isa<MDString>(MD); - HasMDLocation |= isa<MDLocation>(MD); - HasGenericDebugNode |= isa<GenericDebugNode>(MD); + HasDILocation |= isa<DILocation>(MD); + HasGenericDINode |= isa<GenericDINode>(MD); // Replace the dummy ID inserted above with the correct one. MDValueMap may // have changed by inserting operands, so we need a fresh lookup here. diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.h b/llvm/lib/Bitcode/Writer/ValueEnumerator.h index ba245a3de68..92d166e3ba9 100644 --- a/llvm/lib/Bitcode/Writer/ValueEnumerator.h +++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.h @@ -65,8 +65,8 @@ private: typedef DenseMap<const Metadata *, unsigned> MetadataMapType; MetadataMapType MDValueMap; bool HasMDString; - bool HasMDLocation; - bool HasGenericDebugNode; + bool HasDILocation; + bool HasGenericDINode; bool ShouldPreserveUseListOrder; typedef DenseMap<AttributeSet, unsigned> AttributeGroupMapType; @@ -121,8 +121,8 @@ public: } bool hasMDString() const { return HasMDString; } - bool hasMDLocation() const { return HasMDLocation; } - bool hasGenericDebugNode() const { return HasGenericDebugNode; } + bool hasDILocation() const { return HasDILocation; } + bool hasGenericDINode() const { return HasGenericDINode; } bool shouldPreserveUseListOrder() const { return ShouldPreserveUseListOrder; } diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index a8fb9b776d4..d56a1808049 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -668,15 +668,15 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) { raw_svector_ostream OS(Str); OS << "DEBUG_VALUE: "; - const MDLocalVariable *V = MI->getDebugVariable(); - if (auto *SP = dyn_cast<MDSubprogram>(V->getScope())) { + const DILocalVariable *V = MI->getDebugVariable(); + if (auto *SP = dyn_cast<DISubprogram>(V->getScope())) { StringRef Name = SP->getDisplayName(); if (!Name.empty()) OS << Name << ":"; } OS << V->getName(); - const MDExpression *Expr = MI->getDebugExpression(); + const DIExpression *Expr = MI->getDebugExpression(); if (Expr->isBitPiece()) OS << " [bit_piece offset=" << Expr->getBitPieceOffset() << " size=" << Expr->getBitPieceSize() << "]"; diff --git a/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp b/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp index 9cb0aab7705..3c46a99d084 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp @@ -204,7 +204,7 @@ void llvm::calculateDbgValueHistory(const MachineFunction *MF, // Use the base variable (without any DW_OP_piece expressions) // as index into History. The full variables including the // piece expressions are attached to the MI. - const MDLocalVariable *RawVar = MI.getDebugVariable(); + const DILocalVariable *RawVar = MI.getDebugVariable(); assert(RawVar->isValidLocationForIntrinsic(MI.getDebugLoc()) && "Expected inlined-at fields to agree"); InlinedVariable Var(RawVar, MI.getDebugLoc()->getInlinedAt()); diff --git a/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h b/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h index c25aaffd2d1..546d1b44378 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h +++ b/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h @@ -17,8 +17,8 @@ namespace llvm { class MachineFunction; class MachineInstr; -class MDLocalVariable; -class MDLocation; +class DILocalVariable; +class DILocation; class TargetRegisterInfo; // For each user variable, keep a list of instruction ranges where this variable @@ -32,7 +32,7 @@ class DbgValueHistoryMap { public: typedef std::pair<const MachineInstr *, const MachineInstr *> InstrRange; typedef SmallVector<InstrRange, 4> InstrRanges; - typedef std::pair<const MDLocalVariable *, const MDLocation *> + typedef std::pair<const DILocalVariable *, const DILocation *> InlinedVariable; typedef MapVector<InlinedVariable, InstrRanges> InstrRangesMap; diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h b/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h index ff3eb030a65..6a943c64ea2 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h +++ b/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h @@ -29,25 +29,25 @@ class DebugLocEntry { public: /// \brief A single location or constant. struct Value { - Value(const MDExpression *Expr, int64_t i) + Value(const DIExpression *Expr, int64_t i) : Expression(Expr), EntryKind(E_Integer) { Constant.Int = i; } - Value(const MDExpression *Expr, const ConstantFP *CFP) + Value(const DIExpression *Expr, const ConstantFP *CFP) : Expression(Expr), EntryKind(E_ConstantFP) { Constant.CFP = CFP; } - Value(const MDExpression *Expr, const ConstantInt *CIP) + Value(const DIExpression *Expr, const ConstantInt *CIP) : Expression(Expr), EntryKind(E_ConstantInt) { Constant.CIP = CIP; } - Value(const MDExpression *Expr, MachineLocation Loc) + Value(const DIExpression *Expr, MachineLocation Loc) : Expression(Expr), EntryKind(E_Location), Loc(Loc) { - assert(cast<MDExpression>(Expr)->isValid()); + assert(cast<DIExpression>(Expr)->isValid()); } /// Any complex address location expression for this Value. - const MDExpression *Expression; + const DIExpression *Expression; /// Type of entry that this represents. enum EntryType { E_Location, E_Integer, E_ConstantFP, E_ConstantInt }; @@ -72,7 +72,7 @@ public: const ConstantInt *getConstantInt() const { return Constant.CIP; } MachineLocation getLoc() const { return Loc; } bool isBitPiece() const { return getExpression()->isBitPiece(); } - const MDExpression *getExpression() const { return Expression; } + const DIExpression *getExpression() const { return Expression; } friend bool operator==(const Value &, const Value &); friend bool operator<(const Value &, const Value &); }; @@ -94,8 +94,8 @@ public: /// Return true if the merge was successful. bool MergeValues(const DebugLocEntry &Next) { if (Begin == Next.Begin) { - auto *Expr = cast_or_null<MDExpression>(Values[0].Expression); - auto *NextExpr = cast_or_null<MDExpression>(Next.Values[0].Expression); + auto *Expr = cast_or_null<DIExpression>(Values[0].Expression); + auto *NextExpr = cast_or_null<DIExpression>(Next.Values[0].Expression); if (Expr->isBitPiece() && NextExpr->isBitPiece()) { addValues(Next.Values); End = Next.End; @@ -143,7 +143,7 @@ public: /// \brief Lower this entry into a DWARF expression. void finalize(const AsmPrinter &AP, DebugLocStream &Locs, - const MDBasicType *BT); + const DIBasicType *BT); }; /// \brief Compare two Values for equality. diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 856920f2ffc..c10e70352af 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -16,7 +16,7 @@ namespace llvm { -DwarfCompileUnit::DwarfCompileUnit(unsigned UID, const MDCompileUnit *Node, +DwarfCompileUnit::DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU) : DwarfUnit(UID, dwarf::DW_TAG_compile_unit, Node, A, DW, DWU), @@ -98,7 +98,7 @@ static const ConstantExpr *getMergedGlobalExpr(const Value *V) { /// getOrCreateGlobalVariableDIE - get or create global variable DIE. DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE( - const MDGlobalVariable *GV) { + const DIGlobalVariable *GV) { // Check for pre-existence. if (DIE *Die = getDIE(GV)) return Die; @@ -114,7 +114,7 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE( // Add to map. DIE *VariableDIE = &createAndAddDIE(GV->getTag(), *ContextDIE, GV); - MDScope *DeclContext; + DIScope *DeclContext; if (auto *SDMDecl = GV->getStaticDataMemberDeclaration()) { DeclContext = resolve(SDMDecl->getScope()); assert(SDMDecl->isStaticMember() && "Expected static member decl"); @@ -277,7 +277,7 @@ void DwarfCompileUnit::attachLowHighPC(DIE &D, const MCSymbol *Begin, // Find DIE for the given subprogram and attach appropriate DW_AT_low_pc // and DW_AT_high_pc attributes. If there are global variables in this // scope then create and insert DIEs for these variables. -DIE &DwarfCompileUnit::updateSubprogramScopeDIE(const MDSubprogram *SP) { +DIE &DwarfCompileUnit::updateSubprogramScopeDIE(const DISubprogram *SP) { DIE *SPDie = getOrCreateSubprogramDIE(SP, includeMinimalInlineScopes()); attachLowHighPC(*SPDie, Asm->getFunctionBegin(), Asm->getFunctionEnd()); @@ -308,7 +308,7 @@ void DwarfCompileUnit::constructScopeDIE( auto *DS = Scope->getScopeNode(); - assert((Scope->getInlinedAt() || !isa<MDSubprogram>(DS)) && + assert((Scope->getInlinedAt() || !isa<DISubprogram>(DS)) && "Only handle inlined subprograms here, use " "constructSubprogramScopeDIE for non-inlined " "subprograms"); @@ -319,7 +319,7 @@ void DwarfCompileUnit::constructScopeDIE( // avoid creating un-used children then removing them later when we find out // the scope DIE is null. std::unique_ptr<DIE> ScopeDIE; - if (Scope->getParent() && isa<MDSubprogram>(DS)) { + if (Scope->getParent() && isa<DISubprogram>(DS)) { ScopeDIE = constructInlinedScopeDIE(Scope); if (!ScopeDIE) return; @@ -341,7 +341,7 @@ void DwarfCompileUnit::constructScopeDIE( // There is no need to emit empty lexical block DIE. for (const auto &E : DD->findImportedEntitiesForScope(DS)) Children.push_back( - constructImportedEntityDIE(cast<MDImportedEntity>(E.second))); + constructImportedEntityDIE(cast<DIImportedEntity>(E.second))); } // If there are only other scopes as children, put them directly in the @@ -432,7 +432,7 @@ DwarfCompileUnit::constructInlinedScopeDIE(LexicalScope *Scope) { attachRangesOrLowHighPC(*ScopeDIE, Scope->getRanges()); // Add the call site information to the DIE. - const MDLocation *IA = Scope->getInlinedAt(); + const DILocation *IA = Scope->getInlinedAt(); addUInt(*ScopeDIE, dwarf::DW_AT_call_file, None, getOrCreateSourceID(IA->getFilename(), IA->getDirectory())); addUInt(*ScopeDIE, dwarf::DW_AT_call_line, None, IA->getLine()); @@ -563,14 +563,14 @@ void DwarfCompileUnit::constructSubprogramScopeDIE(LexicalScope *Scope) { assert(Scope && Scope->getScopeNode()); assert(!Scope->getInlinedAt()); assert(!Scope->isAbstractScope()); - auto *Sub = cast<MDSubprogram>(Scope->getScopeNode()); + auto *Sub = cast<DISubprogram>(Scope->getScopeNode()); DD->getProcessedSPNodes().insert(Sub); DIE &ScopeDIE = updateSubprogramScopeDIE(Sub); // If this is a variadic function, add an unspecified parameter. - MDTypeRefArray FnArgs = Sub->getType()->getTypeArray(); + DITypeRefArray FnArgs = Sub->getType()->getTypeArray(); // Collect lexical scope children first. // ObjectPointer might be a local (non-argument) local variable if it's a @@ -605,7 +605,7 @@ DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) { if (AbsDef) return; - auto *SP = cast<MDSubprogram>(Scope->getScopeNode()); + auto *SP = cast<DISubprogram>(Scope->getScopeNode()); DIE *ContextDIE; @@ -633,18 +633,18 @@ DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) { } std::unique_ptr<DIE> -DwarfCompileUnit::constructImportedEntityDIE(const MDImportedEntity *Module) { +DwarfCompileUnit::constructImportedEntityDIE(const DIImportedEntity *Module) { std::unique_ptr<DIE> IMDie = make_unique<DIE>((dwarf::Tag)Module->getTag()); insertDIE(Module, IMDie.get()); DIE *EntityDie; auto *Entity = resolve(Module->getEntity()); - if (auto *NS = dyn_cast<MDNamespace>(Entity)) + if (auto *NS = dyn_cast<DINamespace>(Entity)) EntityDie = getOrCreateNameSpace(NS); - else if (auto *SP = dyn_cast<MDSubprogram>(Entity)) + else if (auto *SP = dyn_cast<DISubprogram>(Entity)) EntityDie = getOrCreateSubprogramDIE(SP); - else if (auto *T = dyn_cast<MDType>(Entity)) + else if (auto *T = dyn_cast<DIType>(Entity)) EntityDie = getOrCreateTypeDIE(T); - else if (auto *GV = dyn_cast<MDGlobalVariable>(Entity)) + else if (auto *GV = dyn_cast<DIGlobalVariable>(Entity)) EntityDie = getOrCreateGlobalVariableDIE(GV); else EntityDie = getDIE(Entity); @@ -659,7 +659,7 @@ DwarfCompileUnit::constructImportedEntityDIE(const MDImportedEntity *Module) { return IMDie; } -void DwarfCompileUnit::finishSubprogramDefinition(const MDSubprogram *SP) { +void DwarfCompileUnit::finishSubprogramDefinition(const DISubprogram *SP) { DIE *D = getDIE(SP); if (DIE *AbsSPDIE = DU->getAbstractSPDies().lookup(SP)) { if (D) @@ -676,7 +676,7 @@ void DwarfCompileUnit::finishSubprogramDefinition(const MDSubprogram *SP) { applySubprogramAttributesToDefinition(SP, *D); } } -void DwarfCompileUnit::collectDeadVariables(const MDSubprogram *SP) { +void DwarfCompileUnit::collectDeadVariables(const DISubprogram *SP) { assert(SP && "CU's subprogram list contains a non-subprogram"); assert(SP->isDefinition() && "CU's subprogram list contains a subprogram declaration"); @@ -688,7 +688,7 @@ void DwarfCompileUnit::collectDeadVariables(const MDSubprogram *SP) { if (!SPDIE) SPDIE = getDIE(SP); assert(SPDIE); - for (const MDLocalVariable *DV : Variables) { + for (const DILocalVariable *DV : Variables) { DbgVariable NewVar(DV, /* IA */ nullptr, /* Expr */ nullptr, DD); auto VariableDie = constructVariableDIE(NewVar); applyVariableAttributes(NewVar, *VariableDie); @@ -708,7 +708,7 @@ void DwarfCompileUnit::emitHeader(bool UseOffsets) { /// addGlobalName - Add a new global name to the compile unit. void DwarfCompileUnit::addGlobalName(StringRef Name, DIE &Die, - const MDScope *Context) { + const DIScope *Context) { if (includeMinimalInlineScopes()) return; std::string FullName = getParentContextString(Context) + Name.str(); @@ -716,8 +716,8 @@ void DwarfCompileUnit::addGlobalName(StringRef Name, DIE &Die, } /// Add a new global type to the unit. -void DwarfCompileUnit::addGlobalType(const MDType *Ty, const DIE &Die, - const MDScope *Context) { +void DwarfCompileUnit::addGlobalType(const DIType *Ty, const DIE &Die, + const DIScope *Context) { if (includeMinimalInlineScopes()) return; std::string FullName = getParentContextString(Context) + Ty->getName().str(); @@ -764,7 +764,7 @@ void DwarfCompileUnit::addComplexAddress(const DbgVariable &DV, DIE &Die, DIELoc *Loc = new (DIEValueAllocator) DIELoc(); DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc); assert(DV.getExpression().size() == 1); - const MDExpression *Expr = DV.getExpression().back(); + const DIExpression *Expr = DV.getExpression().back(); bool ValidReg; if (Location.getOffset()) { ValidReg = DwarfExpr.AddMachineRegIndirect(Location.getReg(), @@ -807,7 +807,7 @@ void DwarfCompileUnit::addExpr(DIELoc &Die, dwarf::Form Form, } void DwarfCompileUnit::applySubprogramAttributesToDefinition( - const MDSubprogram *SP, DIE &SPDie) { + const DISubprogram *SP, DIE &SPDie) { auto *SPDecl = SP->getDeclaration(); auto *Context = resolve(SPDecl ? SPDecl->getScope() : SP->getScope()); applySubprogramAttributes(SP, SPDie, includeMinimalInlineScopes()); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h index 76811d9401c..50e4a54eb3e 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h @@ -66,7 +66,7 @@ class DwarfCompileUnit : public DwarfUnit { bool includeMinimalInlineScopes() const; public: - DwarfCompileUnit(unsigned UID, const MDCompileUnit *Node, AsmPrinter *A, + DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU); DwarfCompileUnit *getSkeleton() const { @@ -79,7 +79,7 @@ public: void applyStmtList(DIE &D); /// getOrCreateGlobalVariableDIE - get or create global variable DIE. - DIE *getOrCreateGlobalVariableDIE(const MDGlobalVariable *GV); + DIE *getOrCreateGlobalVariableDIE(const DIGlobalVariable *GV); /// addLabelAddress - Add a dwarf label attribute data and value using /// either DW_FORM_addr or DW_FORM_GNU_addr_index. @@ -113,7 +113,7 @@ public: /// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global /// variables in this scope then create and insert DIEs for these /// variables. - DIE &updateSubprogramScopeDIE(const MDSubprogram *SP); + DIE &updateSubprogramScopeDIE(const DISubprogram *SP); void constructScopeDIE(LexicalScope *Scope, SmallVectorImpl<std::unique_ptr<DIE>> &FinalChildren); @@ -156,11 +156,11 @@ public: /// \brief Construct import_module DIE. std::unique_ptr<DIE> - constructImportedEntityDIE(const MDImportedEntity *Module); + constructImportedEntityDIE(const DIImportedEntity *Module); - void finishSubprogramDefinition(const MDSubprogram *SP); + void finishSubprogramDefinition(const DISubprogram *SP); - void collectDeadVariables(const MDSubprogram *SP); + void collectDeadVariables(const DISubprogram *SP); /// Set the skeleton unit associated with this unit. void setSkeleton(DwarfCompileUnit &Skel) { Skeleton = &Skel; } @@ -183,11 +183,11 @@ public: } /// Add a new global name to the compile unit. - void addGlobalName(StringRef Name, DIE &Die, const MDScope *Context) override; + void addGlobalName(StringRef Name, DIE &Die, const DIScope *Context) override; /// Add a new global type to the compile unit. - void addGlobalType(const MDType *Ty, const DIE &Die, - const MDScope *Context) override; + void addGlobalType(const DIType *Ty, const DIE &Die, + const DIScope *Context) override; const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; } const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; } @@ -215,7 +215,7 @@ public: /// Add a Dwarf expression attribute data and value. void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr); - void applySubprogramAttributesToDefinition(const MDSubprogram *SP, + void applySubprogramAttributesToDefinition(const DISubprogram *SP, DIE &SPDie); /// getRangeLists - Get the vector of range lists. diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 345eea67f7d..4f2b47f0e6f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -130,7 +130,7 @@ bool DebugLocDwarfExpression::isFrameRegister(unsigned MachineReg) { /// resolve - Look in the DwarfDebug map for the MDNode that /// corresponds to the reference. -template <typename T> T *DbgVariable::resolve(TypedDebugNodeRef<T> Ref) const { +template <typename T> T *DbgVariable::resolve(TypedDINodeRef<T> Ref) const { return DD->resolve(Ref); } @@ -141,8 +141,8 @@ bool DbgVariable::isBlockByrefVariable() const { ->isBlockByrefStruct(); } -const MDType *DbgVariable::getType() const { - MDType *Ty = Var->getType().resolve(DD->getTypeIdentifierMap()); +const DIType *DbgVariable::getType() const { + DIType *Ty = Var->getType().resolve(DD->getTypeIdentifierMap()); // FIXME: isBlockByrefVariable should be reformulated in terms of complex // addresses instead. if (Ty->isBlockByrefStruct()) { @@ -170,15 +170,15 @@ const MDType *DbgVariable::getType() const { have a DW_AT_location that tells the debugger how to unwind through the pointers and __Block_byref_x_VarName struct to find the actual value of the variable. The function addBlockByrefType does this. */ - MDType *subType = Ty; + DIType *subType = Ty; uint16_t tag = Ty->getTag(); if (tag == dwarf::DW_TAG_pointer_type) - subType = resolve(cast<MDDerivedType>(Ty)->getBaseType()); + subType = resolve(cast<DIDerivedType>(Ty)->getBaseType()); - auto Elements = cast<MDCompositeTypeBase>(subType)->getElements(); + auto Elements = cast<DICompositeTypeBase>(subType)->getElements(); for (unsigned i = 0, N = Elements.size(); i < N; ++i) { - auto *DT = cast<MDDerivedTypeBase>(Elements[i]); + auto *DT = cast<DIDerivedTypeBase>(Elements[i]); if (getName() == DT->getName()) return resolve(DT->getBaseType()); } @@ -277,7 +277,7 @@ static StringRef getObjCMethodName(StringRef In) { // TODO: Determine whether or not we should add names for programs // that do not have a DW_AT_name or DW_AT_linkage_name field - this // is only slightly different than the lookup of non-standard ObjC names. -void DwarfDebug::addSubprogramNames(const MDSubprogram *SP, DIE &Die) { +void DwarfDebug::addSubprogramNames(const DISubprogram *SP, DIE &Die) { if (!SP->isDefinition()) return; addAccelName(SP->getName(), Die); @@ -305,9 +305,9 @@ void DwarfDebug::addSubprogramNames(const MDSubprogram *SP, DIE &Die) { bool DwarfDebug::isSubprogramContext(const MDNode *Context) { if (!Context) return false; - if (isa<MDSubprogram>(Context)) + if (isa<DISubprogram>(Context)) return true; - if (auto *T = dyn_cast<MDType>(Context)) + if (auto *T = dyn_cast<DIType>(Context)) return isSubprogramContext(resolve(T->getScope())); return false; } @@ -364,7 +364,7 @@ void DwarfDebug::addGnuPubAttributes(DwarfUnit &U, DIE &D) const { // Create new DwarfCompileUnit for the given metadata node with tag // DW_TAG_compile_unit. DwarfCompileUnit & -DwarfDebug::constructDwarfCompileUnit(const MDCompileUnit *DIUnit) { +DwarfDebug::constructDwarfCompileUnit(const DICompileUnit *DIUnit) { StringRef FN = DIUnit->getFilename(); CompilationDir = DIUnit->getDirectory(); @@ -422,7 +422,7 @@ DwarfDebug::constructDwarfCompileUnit(const MDCompileUnit *DIUnit) { } void DwarfDebug::constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU, - const MDImportedEntity *N) { + const DIImportedEntity *N) { if (DIE *D = TheCU.getOrCreateContextDIE(N->getScope())) D->addChild(TheCU.constructImportedEntityDIE(N)); } @@ -446,7 +446,7 @@ void DwarfDebug::beginModule() { SingleCU = CU_Nodes->getNumOperands() == 1; for (MDNode *N : CU_Nodes->operands()) { - auto *CUNode = cast<MDCompileUnit>(N); + auto *CUNode = cast<DICompileUnit>(N); DwarfCompileUnit &CU = constructDwarfCompileUnit(CUNode); for (auto *IE : CUNode->getImportedEntities()) ScopesWithImportedEntities.push_back(std::make_pair(IE->getScope(), IE)); @@ -462,12 +462,12 @@ void DwarfDebug::beginModule() { for (auto *Ty : CUNode->getEnumTypes()) { // The enum types array by design contains pointers to // MDNodes rather than DIRefs. Unique them here. - CU.getOrCreateTypeDIE(cast<MDType>(resolve(Ty->getRef()))); + CU.getOrCreateTypeDIE(cast<DIType>(resolve(Ty->getRef()))); } for (auto *Ty : CUNode->getRetainedTypes()) { // The retained types array by design contains pointers to // MDNodes rather than DIRefs. Unique them here. - CU.getOrCreateTypeDIE(cast<MDType>(resolve(Ty->getRef()))); + CU.getOrCreateTypeDIE(cast<DIType>(resolve(Ty->getRef()))); } // Emit imported_modules last so that the relevant context is already // available. @@ -501,7 +501,7 @@ void DwarfDebug::finishVariableDefinitions() { void DwarfDebug::finishSubprogramDefinitions() { for (const auto &P : SPMap) forBothCUs(*P.second, [&](DwarfCompileUnit &CU) { - CU.finishSubprogramDefinition(cast<MDSubprogram>(P.first)); + CU.finishSubprogramDefinition(cast<DISubprogram>(P.first)); }); } @@ -512,7 +512,7 @@ void DwarfDebug::collectDeadVariables() { if (NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu")) { for (MDNode *N : CU_Nodes->operands()) { - auto *TheCU = cast<MDCompileUnit>(N); + auto *TheCU = cast<DICompileUnit>(N); // Construct subprogram DIE and add variables DIEs. DwarfCompileUnit *SPCU = static_cast<DwarfCompileUnit *>(CUMap.lookup(TheCU)); @@ -662,7 +662,7 @@ void DwarfDebug::endModule() { // Find abstract variable, if any, associated with Var. DbgVariable * DwarfDebug::getExistingAbstractVariable(InlinedVariable IV, - const MDLocalVariable *&Cleansed) { + const DILocalVariable *&Cleansed) { // More then one inlined variable corresponds to one abstract variable. Cleansed = IV.first; auto I = AbstractVariables.find(Cleansed); @@ -672,11 +672,11 @@ DwarfDebug::getExistingAbstractVariable(InlinedVariable IV, } DbgVariable *DwarfDebug::getExistingAbstractVariable(InlinedVariable IV) { - const MDLocalVariable *Cleansed; + const DILocalVariable *Cleansed; return getExistingAbstractVariable(IV, Cleansed); } -void DwarfDebug::createAbstractVariable(const MDLocalVariable *Var, +void DwarfDebug::createAbstractVariable(const DILocalVariable *Var, LexicalScope *Scope) { auto AbsDbgVariable = make_unique<DbgVariable>(Var, /* IA */ nullptr, /* Expr */ nullptr, this); @@ -686,22 +686,22 @@ void DwarfDebug::createAbstractVariable(const MDLocalVariable *Var, void DwarfDebug::ensureAbstractVariableIsCreated(InlinedVariable IV, const MDNode *ScopeNode) { - const MDLocalVariable *Cleansed = nullptr; + const DILocalVariable *Cleansed = nullptr; if (getExistingAbstractVariable(IV, Cleansed)) return; createAbstractVariable(Cleansed, LScopes.getOrCreateAbstractScope( - cast<MDLocalScope>(ScopeNode))); + cast<DILocalScope>(ScopeNode))); } void DwarfDebug::ensureAbstractVariableIsCreatedIfScoped( InlinedVariable IV, const MDNode *ScopeNode) { - const MDLocalVariable *Cleansed = nullptr; + const DILocalVariable *Cleansed = nullptr; if (getExistingAbstractVariable(IV, Cleansed)) return; if (LexicalScope *Scope = - LScopes.findAbstractScope(cast_or_null<MDLocalScope>(ScopeNode))) + LScopes.findAbstractScope(cast_or_null<DILocalScope>(ScopeNode))) createAbstractVariable(Cleansed, Scope); } @@ -722,7 +722,7 @@ void DwarfDebug::collectVariableInfoFromMMITable( if (!Scope) continue; - const MDExpression *Expr = cast_or_null<MDExpression>(VI.Expr); + const DIExpression *Expr = cast_or_null<DIExpression>(VI.Expr); ensureAbstractVariableIsCreatedIfScoped(Var, Scope->getScopeNode()); auto RegVar = make_unique<DbgVariable>(Var.first, Var.second, Expr, this, VI.Slot); @@ -733,7 +733,7 @@ void DwarfDebug::collectVariableInfoFromMMITable( // Get .debug_loc entry for the instruction range starting at MI. static DebugLocEntry::Value getDebugLocValue(const MachineInstr *MI) { - const MDExpression *Expr = MI->getDebugExpression(); + const DIExpression *Expr = MI->getDebugExpression(); assert(MI->getNumOperands() == 4); if (MI->getOperand(0).isReg()) { @@ -757,7 +757,7 @@ static DebugLocEntry::Value getDebugLocValue(const MachineInstr *MI) { } /// Determine whether two variable pieces overlap. -static bool piecesOverlap(const MDExpression *P1, const MDExpression *P2) { +static bool piecesOverlap(const DIExpression *P1, const DIExpression *P2) { if (!P1->isBitPiece() || !P2->isBitPiece()) return true; unsigned l1 = P1->getBitPieceOffset(); @@ -809,7 +809,7 @@ DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc, } // If this piece overlaps with any open ranges, truncate them. - const MDExpression *DIExpr = Begin->getDebugExpression(); + const DIExpression *DIExpr = Begin->getDebugExpression(); auto Last = std::remove_if(OpenRanges.begin(), OpenRanges.end(), [&](DebugLocEntry::Value R) { return piecesOverlap(DIExpr, R.getExpression()); @@ -874,7 +874,7 @@ DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc, // Find variables for each lexical scope. void DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU, - const MDSubprogram *SP, + const DISubprogram *SP, DenseSet<InlinedVariable> &Processed) { // Grab the variable info that was squirreled away in the MMI side-table. collectVariableInfoFromMMITable(Processed); @@ -890,7 +890,7 @@ void DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU, continue; LexicalScope *Scope = nullptr; - if (const MDLocation *IA = IV.second) + if (const DILocation *IA = IV.second) Scope = LScopes.findInlinedScope(IV.first->getScope(), IA); else Scope = LScopes.findLexicalScope(IV.first->getScope()); @@ -918,10 +918,10 @@ void DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU, SmallVector<DebugLocEntry, 8> Entries; buildLocationList(Entries, Ranges); - // If the variable has an MDBasicType, extract it. Basic types cannot have + // If the variable has an DIBasicType, extract it. Basic types cannot have // unique identifiers, so don't bother resolving the type with the // identifier map. - const MDBasicType *BT = dyn_cast<MDBasicType>( + const DIBasicType *BT = dyn_cast<DIBasicType>( static_cast<const Metadata *>(IV.first->getType())); // Finalize the entry by lowering it into a DWARF bytestream. @@ -930,7 +930,7 @@ void DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU, } // Collect info for variables that were optimized out. - for (const MDLocalVariable *DV : SP->getVariables()) { + for (const DILocalVariable *DV : SP->getVariables()) { if (!Processed.insert(InlinedVariable(DV, nullptr)).second) continue; if (LexicalScope *Scope = LScopes.findLexicalScope(DV->getScope())) { @@ -1128,14 +1128,14 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) { // The first mention of a function argument gets the CurrentFnBegin // label, so arguments are visible when breaking at function entry. - const MDLocalVariable *DIVar = Ranges.front().first->getDebugVariable(); + const DILocalVariable *DIVar = Ranges.front().first->getDebugVariable(); if (DIVar->getTag() == dwarf::DW_TAG_arg_variable && getDISubprogram(DIVar->getScope())->describes(MF->getFunction())) { LabelsBeforeInsn[Ranges.front().first] = Asm->getFunctionBegin(); if (Ranges.front().first->getDebugExpression()->isBitPiece()) { // Mark all non-overlapping initial pieces. for (auto I = Ranges.begin(); I != Ranges.end(); ++I) { - const MDExpression *Piece = I->first->getDebugExpression(); + const DIExpression *Piece = I->first->getDebugExpression(); if (std::all_of(Ranges.begin(), I, [&](DbgValueHistoryMap::InstrRange Pred) { return !piecesOverlap(Piece, Pred.first->getDebugExpression()); @@ -1159,7 +1159,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) { // Record beginning of function. PrologEndLoc = findPrologueEndLoc(MF); - if (MDLocation *L = PrologEndLoc) { + if (DILocation *L = PrologEndLoc) { // We'd like to list the prologue as "not statements" but GDB behaves // poorly if we do that. Revisit this with caution/GDB (7.5+) testing. auto *SP = L->getInlinedAtScope()->getSubprogram(); @@ -1186,7 +1186,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) { Asm->OutStreamer->getContext().setDwarfCompileUnitID(0); LexicalScope *FnScope = LScopes.getCurrentFunctionScope(); - auto *SP = cast<MDSubprogram>(FnScope->getScopeNode()); + auto *SP = cast<DISubprogram>(FnScope->getScopeNode()); DwarfCompileUnit &TheCU = *SPMap.lookup(SP); DenseSet<InlinedVariable> ProcessedVars; @@ -1216,9 +1216,9 @@ void DwarfDebug::endFunction(const MachineFunction *MF) { #endif // Construct abstract scopes. for (LexicalScope *AScope : LScopes.getAbstractScopesList()) { - auto *SP = cast<MDSubprogram>(AScope->getScopeNode()); + auto *SP = cast<DISubprogram>(AScope->getScopeNode()); // Collect info for variables that were optimized out. - for (const MDLocalVariable *DV : SP->getVariables()) { + for (const DILocalVariable *DV : SP->getVariables()) { if (!ProcessedVars.insert(InlinedVariable(DV, nullptr)).second) continue; ensureAbstractVariableIsCreated(InlinedVariable(DV, nullptr), @@ -1254,10 +1254,10 @@ void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S, StringRef Dir; unsigned Src = 1; unsigned Discriminator = 0; - if (auto *Scope = cast_or_null<MDScope>(S)) { + if (auto *Scope = cast_or_null<DIScope>(S)) { Fn = Scope->getFilename(); Dir = Scope->getDirectory(); - if (auto *LBF = dyn_cast<MDLexicalBlockFile>(Scope)) + if (auto *LBF = dyn_cast<DILexicalBlockFile>(Scope)) Discriminator = LBF->getDiscriminator(); unsigned CUID = Asm->OutStreamer->getContext().getDwarfCompileUnitID(); @@ -1471,7 +1471,7 @@ void DwarfDebug::emitDebugLocEntry(ByteStreamer &Streamer, Streamer.EmitInt8(Byte, Comment != End ? *(Comment++) : ""); } -static void emitDebugLocValue(const AsmPrinter &AP, const MDBasicType *BT, +static void emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT, ByteStreamer &Streamer, const DebugLocEntry::Value &Value, unsigned PieceOffsetInBits) { @@ -1487,7 +1487,7 @@ static void emitDebugLocValue(const AsmPrinter &AP, const MDBasicType *BT, DwarfExpr.AddUnsignedConstant(Value.getInt()); } else if (Value.isLocation()) { MachineLocation Loc = Value.getLoc(); - const MDExpression *Expr = Value.getExpression(); + const DIExpression *Expr = Value.getExpression(); if (!Expr || !Expr->getNumElements()) // Regular entry. AP.EmitDwarfRegOp(Streamer, Loc); @@ -1508,7 +1508,7 @@ static void emitDebugLocValue(const AsmPrinter &AP, const MDBasicType *BT, } void DebugLocEntry::finalize(const AsmPrinter &AP, DebugLocStream &Locs, - const MDBasicType *BT) { + const DIBasicType *BT) { Locs.startEntry(Begin, End); BufferByteStreamer Streamer = Locs.getStreamer(); const DebugLocEntry::Value &Value = Values[0]; @@ -1522,7 +1522,7 @@ void DebugLocEntry::finalize(const AsmPrinter &AP, DebugLocStream &Locs, unsigned Offset = 0; for (auto Piece : Values) { - const MDExpression *Expr = Piece.getExpression(); + const DIExpression *Expr = Piece.getExpression(); unsigned PieceOffset = Expr->getBitPieceOffset(); unsigned PieceSize = Expr->getBitPieceSize(); assert(Offset <= PieceOffset && "overlapping or duplicate pieces"); @@ -1903,7 +1903,7 @@ static uint64_t makeTypeSignature(StringRef Identifier) { void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier, DIE &RefDie, - const MDCompositeType *CTy) { + const DICompositeType *CTy) { // Fast path if we're building some type units and one has already used the // address pool we know we're going to throw away all this work anyway, so // don't bother building dependent types. @@ -1962,7 +1962,7 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU, // This is inefficient because all the dependent types will be rebuilt // from scratch, including building them in type units, discovering that // they depend on addresses, throwing them out and rebuilding them. - CU.constructTypeDIE(RefDie, cast<MDCompositeType>(CTy)); + CU.constructTypeDIE(RefDie, cast<DICompositeType>(CTy)); return; } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index 708fb8f01e5..59024a78a7c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -75,9 +75,9 @@ public: /// - Variables that are described by multiple MMI table entries have multiple /// expressions and frame indices. class DbgVariable { - const MDLocalVariable *Var; /// Variable Descriptor. - const MDLocation *IA; /// Inlined at location. - SmallVector<const MDExpression *, 1> + const DILocalVariable *Var; /// Variable Descriptor. + const DILocation *IA; /// Inlined at location. + SmallVector<const DIExpression *, 1> Expr; /// Complex address location expression. DIE *TheDIE; /// Variable DIE. unsigned DebugLocListIndex; /// Offset in DebugLocs. @@ -87,8 +87,8 @@ class DbgVariable { public: /// Construct a DbgVariable from a variable. - DbgVariable(const MDLocalVariable *V, const MDLocation *IA, - const MDExpression *E, DwarfDebug *DD, int FI = ~0) + DbgVariable(const DILocalVariable *V, const DILocation *IA, + const DIExpression *E, DwarfDebug *DD, int FI = ~0) : Var(V), IA(IA), Expr(1, E), TheDIE(nullptr), DebugLocListIndex(~0U), MInsn(nullptr), DD(DD) { FrameIndex.push_back(FI); @@ -106,9 +106,9 @@ public: } // Accessors. - const MDLocalVariable *getVariable() const { return Var; } - const MDLocation *getInlinedAt() const { return IA; } - const ArrayRef<const MDExpression *> getExpression() const { return Expr; } + const DILocalVariable *getVariable() const { return Var; } + const DILocation *getInlinedAt() const { return IA; } + const ArrayRef<const DIExpression *> getExpression() const { return Expr; } void setDIE(DIE &D) { TheDIE = &D; } DIE *getDIE() const { return TheDIE; } void setDebugLocListIndex(unsigned O) { DebugLocListIndex = O; } @@ -130,7 +130,7 @@ public: FrameIndex.append(FI.begin(), FI.end()); } assert(Expr.size() > 1 ? std::all_of(Expr.begin(), Expr.end(), - [](const MDExpression *E) { + [](const DIExpression *E) { return E->isBitPiece(); }) : (true && "conflicting locations for variable")); @@ -167,12 +167,12 @@ public: return Expr.back()->getNumElements() > 0; } bool isBlockByrefVariable() const; - const MDType *getType() const; + const DIType *getType() const; private: /// resolve - Look in the DwarfDebug map for the MDNode that /// corresponds to the reference. - template <typename T> T *resolve(TypedDebugNodeRef<T> Ref) const; + template <typename T> T *resolve(TypedDINodeRef<T> Ref) const; }; @@ -271,7 +271,7 @@ class DwarfDebug : public AsmPrinterHandler { DenseMap<const MDNode *, const DwarfTypeUnit *> DwarfTypeUnits; SmallVector< - std::pair<std::unique_ptr<DwarfTypeUnit>, const MDCompositeType *>, 1> + std::pair<std::unique_ptr<DwarfTypeUnit>, const DICompositeType *>, 1> TypeUnitsUnderConstruction; // Whether to emit the pubnames/pubtypes sections. @@ -324,7 +324,7 @@ class DwarfDebug : public AsmPrinterHandler { DwarfAccelTable AccelNamespace; DwarfAccelTable AccelTypes; - DenseMap<const Function *, MDSubprogram *> FunctionDIs; + DenseMap<const Function *, DISubprogram *> FunctionDIs; MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &); @@ -336,9 +336,9 @@ class DwarfDebug : public AsmPrinterHandler { /// \brief Find abstract variable associated with Var. DbgVariable *getExistingAbstractVariable(InlinedVariable IV, - const MDLocalVariable *&Cleansed); + const DILocalVariable *&Cleansed); DbgVariable *getExistingAbstractVariable(InlinedVariable IV); - void createAbstractVariable(const MDLocalVariable *DV, LexicalScope *Scope); + void createAbstractVariable(const DILocalVariable *DV, LexicalScope *Scope); void ensureAbstractVariableIsCreated(InlinedVariable Var, const MDNode *Scope); void ensureAbstractVariableIsCreatedIfScoped(InlinedVariable Var, @@ -453,11 +453,11 @@ class DwarfDebug : public AsmPrinterHandler { /// \brief Create new DwarfCompileUnit for the given metadata node with tag /// DW_TAG_compile_unit. - DwarfCompileUnit &constructDwarfCompileUnit(const MDCompileUnit *DIUnit); + DwarfCompileUnit &constructDwarfCompileUnit(const DICompileUnit *DIUnit); /// \brief Construct imported_module or imported_declaration DIE. void constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU, - const MDImportedEntity *N); + const DIImportedEntity *N); /// \brief Register a source line with debug info. Returns the unique /// label that was emitted and which provides correspondence to the @@ -470,7 +470,7 @@ class DwarfDebug : public AsmPrinterHandler { void identifyScopeMarkers(); /// \brief Populate LexicalScope entries with variables' info. - void collectVariableInfo(DwarfCompileUnit &TheCU, const MDSubprogram *SP, + void collectVariableInfo(DwarfCompileUnit &TheCU, const DISubprogram *SP, DenseSet<InlinedVariable> &ProcessedVars); /// \brief Build the location list for all DBG_VALUEs in the @@ -522,7 +522,7 @@ public: /// \brief Add a DIE to the set of types that we're going to pull into /// type units. void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier, - DIE &Die, const MDCompositeType *CTy); + DIE &Die, const DICompositeType *CTy); /// \brief Add a label so that arange data can be generated for it. void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); } @@ -566,7 +566,7 @@ public: void emitDebugLocEntryLocation(const DebugLocStream::Entry &Entry); /// Find the MDNode for the given reference. - template <typename T> T *resolve(TypedDebugNodeRef<T> Ref) const { + template <typename T> T *resolve(TypedDINodeRef<T> Ref) const { return Ref.resolve(TypeIdentifierMap); } @@ -583,7 +583,7 @@ public: /// or another context nested inside a subprogram. bool isSubprogramContext(const MDNode *Context); - void addSubprogramNames(const MDSubprogram *SP, DIE &Die); + void addSubprogramNames(const DISubprogram *SP, DIE &Die); AddressPool &getAddressPool() { return AddrPool; } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp index fbe209a6663..a2799b8d630 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp @@ -192,7 +192,7 @@ static unsigned getOffsetOrZero(unsigned OffsetInBits, return OffsetInBits; } -bool DwarfExpression::AddMachineRegExpression(const MDExpression *Expr, +bool DwarfExpression::AddMachineRegExpression(const DIExpression *Expr, unsigned MachineReg, unsigned PieceOffsetInBits) { auto I = Expr->expr_op_begin(); @@ -240,8 +240,8 @@ bool DwarfExpression::AddMachineRegExpression(const MDExpression *Expr, return true; } -void DwarfExpression::AddExpression(MDExpression::expr_op_iterator I, - MDExpression::expr_op_iterator E, +void DwarfExpression::AddExpression(DIExpression::expr_op_iterator I, + DIExpression::expr_op_iterator E, unsigned PieceOffsetInBits) { for (; I != E; ++I) { switch (I->getOp()) { diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h index 3b77a44c28a..78ec937a6b6 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h @@ -93,13 +93,13 @@ public: /// \param PieceOffsetInBits If this is one piece out of a fragmented /// location, this is the offset of the piece inside the entire variable. /// \return false if no DWARF register exists for MachineReg. - bool AddMachineRegExpression(const MDExpression *Expr, unsigned MachineReg, + bool AddMachineRegExpression(const DIExpression *Expr, unsigned MachineReg, unsigned PieceOffsetInBits = 0); /// Emit a the operations remaining the DIExpressionIterator I. /// \param PieceOffsetInBits If this is one piece out of a fragmented /// location, this is the offset of the piece inside the entire variable. - void AddExpression(MDExpression::expr_op_iterator I, - MDExpression::expr_op_iterator E, + void AddExpression(DIExpression::expr_op_iterator I, + DIExpression::expr_op_iterator E, unsigned PieceOffsetInBits = 0); }; diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp index 50dbb41c07c..1d6298c228a 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp @@ -137,7 +137,7 @@ void DwarfFile::emitStrings(const MCSection *StrSection, bool DwarfFile::addScopeVariable(LexicalScope *LS, DbgVariable *Var) { SmallVectorImpl<DbgVariable *> &Vars = ScopeVariables[LS]; - const MDLocalVariable *DV = Var->getVariable(); + const DILocalVariable *DV = Var->getVariable(); // Variables with positive arg numbers are parameters. if (unsigned ArgNum = DV->getArg()) { // Keep all parameters in order at the start of the variable list to ensure diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h index 19bb3471b08..a3a5e99e3a8 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h @@ -56,7 +56,7 @@ class DwarfFile { /// Maps MDNodes for type system with the corresponding DIEs. These DIEs can /// be shared across CUs, that is why we keep the map here instead /// of in DwarfCompileUnit. - DenseMap<const MDNode *, DIE *> MDTypeNodeToDieMap; + DenseMap<const MDNode *, DIE *> DITypeNodeToDieMap; public: DwarfFile(AsmPrinter *AP, StringRef Pref, BumpPtrAllocator &DA); @@ -103,10 +103,10 @@ public: } void insertDIE(const MDNode *TypeMD, DIE *Die) { - MDTypeNodeToDieMap.insert(std::make_pair(TypeMD, Die)); + DITypeNodeToDieMap.insert(std::make_pair(TypeMD, Die)); } DIE *getDIE(const MDNode *TypeMD) { - return MDTypeNodeToDieMap.lookup(TypeMD); + return DITypeNodeToDieMap.lookup(TypeMD); } }; } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index b721077594c..ee233f710f2 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -64,7 +64,7 @@ bool DIEDwarfExpression::isFrameRegister(unsigned MachineReg) { } DwarfUnit::DwarfUnit(unsigned UID, dwarf::Tag UnitTag, - const MDCompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, + const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU) : UniqueID(UID), CUNode(Node), UnitDie(UnitTag), DebugInfoOffset(0), Asm(A), DD(DW), DU(DWU), IndexTyDie(nullptr), Section(nullptr) { @@ -161,7 +161,7 @@ int64_t DwarfUnit::getDefaultLowerBound() const { } /// Check whether the DIE for this MDNode can be shared across CUs. -static bool isShareableAcrossCUs(const DebugNode *D) { +static bool isShareableAcrossCUs(const DINode *D) { // When the MDNode can be part of the type system, the DIE can be shared // across CUs. // Combining type units and cross-CU DIE sharing is lower value (since @@ -169,18 +169,18 @@ static bool isShareableAcrossCUs(const DebugNode *D) { // level already) but may be implementable for some value in projects // building multiple independent libraries with LTO and then linking those // together. - return (isa<MDType>(D) || - (isa<MDSubprogram>(D) && !cast<MDSubprogram>(D)->isDefinition())) && + return (isa<DIType>(D) || + (isa<DISubprogram>(D) && !cast<DISubprogram>(D)->isDefinition())) && !GenerateDwarfTypeUnits; } -DIE *DwarfUnit::getDIE(const DebugNode *D) const { +DIE *DwarfUnit::getDIE(const DINode *D) const { if (isShareableAcrossCUs(D)) return DU->getDIE(D); return MDNodeToDieMap.lookup(D); } -void DwarfUnit::insertDIE(const DebugNode *Desc, DIE *D) { +void DwarfUnit::insertDIE(const DINode *Desc, DIE *D) { if (isShareableAcrossCUs(Desc)) { DU->insertDIE(Desc, D); return; @@ -320,7 +320,7 @@ void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute, Entry); } -DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const DebugNode *N) { +DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N) { assert(Tag != dwarf::DW_TAG_auto_variable && Tag != dwarf::DW_TAG_arg_variable); Parent.addChild(make_unique<DIE>((dwarf::Tag)Tag)); @@ -354,38 +354,38 @@ void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, StringRef File, addUInt(Die, dwarf::DW_AT_decl_line, None, Line); } -void DwarfUnit::addSourceLine(DIE &Die, const MDLocalVariable *V) { +void DwarfUnit::addSourceLine(DIE &Die, const DILocalVariable *V) { assert(V); addSourceLine(Die, V->getLine(), V->getScope()->getFilename(), V->getScope()->getDirectory()); } -void DwarfUnit::addSourceLine(DIE &Die, const MDGlobalVariable *G) { +void DwarfUnit::addSourceLine(DIE &Die, const DIGlobalVariable *G) { assert(G); addSourceLine(Die, G->getLine(), G->getFilename(), G->getDirectory()); } -void DwarfUnit::addSourceLine(DIE &Die, const MDSubprogram *SP) { +void DwarfUnit::addSourceLine(DIE &Die, const DISubprogram *SP) { assert(SP); addSourceLine(Die, SP->getLine(), SP->getFilename(), SP->getDirectory()); } -void DwarfUnit::addSourceLine(DIE &Die, const MDType *Ty) { +void DwarfUnit::addSourceLine(DIE &Die, const DIType *Ty) { assert(Ty); addSourceLine(Die, Ty->getLine(), Ty->getFilename(), Ty->getDirectory()); } -void DwarfUnit::addSourceLine(DIE &Die, const MDObjCProperty *Ty) { +void DwarfUnit::addSourceLine(DIE &Die, const DIObjCProperty *Ty) { assert(Ty); addSourceLine(Die, Ty->getLine(), Ty->getFilename(), Ty->getDirectory()); } -void DwarfUnit::addSourceLine(DIE &Die, const MDNamespace *NS) { +void DwarfUnit::addSourceLine(DIE &Die, const DINamespace *NS) { addSourceLine(Die, NS->getLine(), NS->getFilename(), NS->getDirectory()); } @@ -459,27 +459,27 @@ bool DwarfUnit::addRegisterOffset(DIELoc &TheDie, unsigned Reg, void DwarfUnit::addBlockByrefAddress(const DbgVariable &DV, DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location) { - const MDType *Ty = DV.getType(); - const MDType *TmpTy = Ty; + const DIType *Ty = DV.getType(); + const DIType *TmpTy = Ty; uint16_t Tag = Ty->getTag(); bool isPointer = false; StringRef varName = DV.getName(); if (Tag == dwarf::DW_TAG_pointer_type) { - auto *DTy = cast<MDDerivedType>(Ty); + auto *DTy = cast<DIDerivedType>(Ty); TmpTy = resolve(DTy->getBaseType()); isPointer = true; } // Find the __forwarding field and the variable field in the __Block_byref // struct. - DebugNodeArray Fields = cast<MDCompositeTypeBase>(TmpTy)->getElements(); - const MDDerivedType *varField = nullptr; - const MDDerivedType *forwardingField = nullptr; + DINodeArray Fields = cast<DICompositeTypeBase>(TmpTy)->getElements(); + const DIDerivedType *varField = nullptr; + const DIDerivedType *forwardingField = nullptr; for (unsigned i = 0, N = Fields.size(); i < N; ++i) { - auto *DT = cast<MDDerivedType>(Fields[i]); + auto *DT = cast<DIDerivedType>(Fields[i]); StringRef fieldName = DT->getName(); if (fieldName == "__forwarding") forwardingField = DT; @@ -534,8 +534,8 @@ void DwarfUnit::addBlockByrefAddress(const DbgVariable &DV, DIE &Die, } /// Return true if type encoding is unsigned. -static bool isUnsignedDIType(DwarfDebug *DD, const MDType *Ty) { - if (auto *DTy = dyn_cast<MDDerivedTypeBase>(Ty)) { +static bool isUnsignedDIType(DwarfDebug *DD, const DIType *Ty) { + if (auto *DTy = dyn_cast<DIDerivedTypeBase>(Ty)) { dwarf::Tag T = (dwarf::Tag)Ty->getTag(); // Encode pointer constants as unsigned bytes. This is used at least for // null pointer constant emission. @@ -557,7 +557,7 @@ static bool isUnsignedDIType(DwarfDebug *DD, const MDType *Ty) { T == dwarf::DW_TAG_volatile_type || T == dwarf::DW_TAG_restrict_type || T == dwarf::DW_TAG_enumeration_type); - if (MDTypeRef Deriv = DTy->getBaseType()) + if (DITypeRef Deriv = DTy->getBaseType()) return isUnsignedDIType(DD, DD->resolve(Deriv)); // FIXME: Enums without a fixed underlying type have unknown signedness // here, leading to incorrectly emitted constants. @@ -565,7 +565,7 @@ static bool isUnsignedDIType(DwarfDebug *DD, const MDType *Ty) { return false; } - auto *BTy = cast<MDBasicType>(Ty); + auto *BTy = cast<DIBasicType>(Ty); unsigned Encoding = BTy->getEncoding(); assert((Encoding == dwarf::DW_ATE_unsigned || Encoding == dwarf::DW_ATE_unsigned_char || @@ -583,7 +583,7 @@ static bool isUnsignedDIType(DwarfDebug *DD, const MDType *Ty) { } /// If this type is derived from a base type then return base type size. -static uint64_t getBaseTypeSize(DwarfDebug *DD, const MDDerivedType *Ty) { +static uint64_t getBaseTypeSize(DwarfDebug *DD, const DIDerivedType *Ty) { unsigned Tag = Ty->getTag(); if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef && @@ -602,7 +602,7 @@ static uint64_t getBaseTypeSize(DwarfDebug *DD, const MDDerivedType *Ty) { BaseType->getTag() == dwarf::DW_TAG_rvalue_reference_type) return Ty->getSizeInBits(); - if (auto *DT = dyn_cast<MDDerivedType>(BaseType)) + if (auto *DT = dyn_cast<DIDerivedType>(BaseType)) return getBaseTypeSize(DD, DT); return BaseType->getSizeInBits(); @@ -636,12 +636,12 @@ void DwarfUnit::addConstantFPValue(DIE &Die, const ConstantFP *CFP) { } void DwarfUnit::addConstantValue(DIE &Die, const ConstantInt *CI, - const MDType *Ty) { + const DIType *Ty) { addConstantValue(Die, CI->getValue(), Ty); } void DwarfUnit::addConstantValue(DIE &Die, const MachineOperand &MO, - const MDType *Ty) { + const DIType *Ty) { assert(MO.isImm() && "Invalid machine operand!"); addConstantValue(Die, isUnsignedDIType(DD, Ty), MO.getImm()); @@ -654,7 +654,7 @@ void DwarfUnit::addConstantValue(DIE &Die, bool Unsigned, uint64_t Val) { Unsigned ? dwarf::DW_FORM_udata : dwarf::DW_FORM_sdata, Val); } -void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, const MDType *Ty) { +void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty) { addConstantValue(Die, Val, isUnsignedDIType(DD, Ty)); } @@ -695,29 +695,29 @@ void DwarfUnit::addLinkageName(DIE &Die, StringRef LinkageName) { GlobalValue::getRealLinkageName(LinkageName)); } -void DwarfUnit::addTemplateParams(DIE &Buffer, DebugNodeArray TParams) { +void DwarfUnit::addTemplateParams(DIE &Buffer, DINodeArray TParams) { // Add template parameters. for (const auto *Element : TParams) { - if (auto *TTP = dyn_cast<MDTemplateTypeParameter>(Element)) + if (auto *TTP = dyn_cast<DITemplateTypeParameter>(Element)) constructTemplateTypeParameterDIE(Buffer, TTP); - else if (auto *TVP = dyn_cast<MDTemplateValueParameter>(Element)) + else if (auto *TVP = dyn_cast<DITemplateValueParameter>(Element)) constructTemplateValueParameterDIE(Buffer, TVP); } } -DIE *DwarfUnit::getOrCreateContextDIE(const MDScope *Context) { - if (!Context || isa<MDFile>(Context)) +DIE *DwarfUnit::getOrCreateContextDIE(const DIScope *Context) { + if (!Context || isa<DIFile>(Context)) return &getUnitDie(); - if (auto *T = dyn_cast<MDType>(Context)) + if (auto *T = dyn_cast<DIType>(Context)) return getOrCreateTypeDIE(T); - if (auto *NS = dyn_cast<MDNamespace>(Context)) + if (auto *NS = dyn_cast<DINamespace>(Context)) return getOrCreateNameSpace(NS); - if (auto *SP = dyn_cast<MDSubprogram>(Context)) + if (auto *SP = dyn_cast<DISubprogram>(Context)) return getOrCreateSubprogramDIE(SP); return getDIE(Context); } -DIE *DwarfUnit::createTypeDIE(const MDCompositeType *Ty) { +DIE *DwarfUnit::createTypeDIE(const DICompositeType *Ty) { auto *Context = resolve(Ty->getScope()); DIE *ContextDIE = getOrCreateContextDIE(Context); @@ -727,7 +727,7 @@ DIE *DwarfUnit::createTypeDIE(const MDCompositeType *Ty) { // Create new type. DIE &TyDIE = createAndAddDIE(Ty->getTag(), *ContextDIE, Ty); - constructTypeDIE(TyDIE, cast<MDCompositeType>(Ty)); + constructTypeDIE(TyDIE, cast<DICompositeType>(Ty)); updateAcceleratorTables(Context, Ty, TyDIE); return &TyDIE; @@ -737,14 +737,13 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) { if (!TyNode) return nullptr; - auto *Ty = cast<MDType>(TyNode); + auto *Ty = cast<DIType>(TyNode); assert(Ty == resolve(Ty->getRef()) && "type was not uniqued, possible ODR violation."); // DW_TAG_restrict_type is not supported in DWARF2 if (Ty->getTag() == dwarf::DW_TAG_restrict_type && DD->getDwarfVersion() <= 2) - return getOrCreateTypeDIE( - resolve(cast<MDDerivedType>(Ty)->getBaseType())); + return getOrCreateTypeDIE(resolve(cast<DIDerivedType>(Ty)->getBaseType())); // Construct the context before querying for the existence of the DIE in case // such construction creates the DIE. @@ -760,11 +759,11 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) { updateAcceleratorTables(Context, Ty, TyDIE); - if (auto *BT = dyn_cast<MDBasicType>(Ty)) + if (auto *BT = dyn_cast<DIBasicType>(Ty)) constructTypeDIE(TyDIE, BT); - else if (auto *STy = dyn_cast<MDSubroutineType>(Ty)) + else if (auto *STy = dyn_cast<DISubroutineType>(Ty)) constructTypeDIE(TyDIE, STy); - else if (auto *CTy = dyn_cast<MDCompositeType>(Ty)) { + else if (auto *CTy = dyn_cast<DICompositeType>(Ty)) { if (GenerateDwarfTypeUnits && !Ty->isForwardDecl()) if (MDString *TypeId = CTy->getRawIdentifier()) { DD->addDwarfTypeUnitType(getCU(), TypeId->getString(), TyDIE, CTy); @@ -773,17 +772,17 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) { } constructTypeDIE(TyDIE, CTy); } else { - constructTypeDIE(TyDIE, cast<MDDerivedType>(Ty)); + constructTypeDIE(TyDIE, cast<DIDerivedType>(Ty)); } return &TyDIE; } -void DwarfUnit::updateAcceleratorTables(const MDScope *Context, - const MDType *Ty, const DIE &TyDIE) { +void DwarfUnit::updateAcceleratorTables(const DIScope *Context, + const DIType *Ty, const DIE &TyDIE) { if (!Ty->getName().empty() && !Ty->isForwardDecl()) { bool IsImplementation = 0; - if (auto *CT = dyn_cast<MDCompositeTypeBase>(Ty)) { + if (auto *CT = dyn_cast<DICompositeTypeBase>(Ty)) { // A runtime language of 0 actually means C/C++ and that any // non-negative value is some version of Objective-C/C++. IsImplementation = CT->getRuntimeLang() == 0 || CT->isObjcClassComplete(); @@ -791,13 +790,13 @@ void DwarfUnit::updateAcceleratorTables(const MDScope *Context, unsigned Flags = IsImplementation ? dwarf::DW_FLAG_type_implementation : 0; DD->addAccelType(Ty->getName(), TyDIE, Flags); - if (!Context || isa<MDCompileUnit>(Context) || isa<MDFile>(Context) || - isa<MDNamespace>(Context)) + if (!Context || isa<DICompileUnit>(Context) || isa<DIFile>(Context) || + isa<DINamespace>(Context)) addGlobalType(Ty, TyDIE, Context); } } -void DwarfUnit::addType(DIE &Entity, const MDType *Ty, +void DwarfUnit::addType(DIE &Entity, const DIType *Ty, dwarf::Attribute Attribute) { assert(Ty && "Trying to add a type that doesn't exist?"); @@ -818,7 +817,7 @@ void DwarfUnit::addType(DIE &Entity, const MDType *Ty, addDIEEntry(Entity, Attribute, Entry); } -std::string DwarfUnit::getParentContextString(const MDScope *Context) const { +std::string DwarfUnit::getParentContextString(const DIScope *Context) const { if (!Context) return ""; @@ -827,8 +826,8 @@ std::string DwarfUnit::getParentContextString(const MDScope *Context) const { return ""; std::string CS; - SmallVector<const MDScope *, 1> Parents; - while (!isa<MDCompileUnit>(Context)) { + SmallVector<const DIScope *, 1> Parents; + while (!isa<DICompileUnit>(Context)) { Parents.push_back(Context); if (Context->getScope()) Context = resolve(Context->getScope()); @@ -841,9 +840,9 @@ std::string DwarfUnit::getParentContextString(const MDScope *Context) const { // Reverse iterate over our list to go from the outermost construct to the // innermost. for (auto I = Parents.rbegin(), E = Parents.rend(); I != E; ++I) { - const MDScope *Ctx = *I; + const DIScope *Ctx = *I; StringRef Name = Ctx->getName(); - if (Name.empty() && isa<MDNamespace>(Ctx)) + if (Name.empty() && isa<DINamespace>(Ctx)) Name = "(anonymous namespace)"; if (!Name.empty()) { CS += Name; @@ -853,7 +852,7 @@ std::string DwarfUnit::getParentContextString(const MDScope *Context) const { return CS; } -void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDBasicType *BTy) { +void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIBasicType *BTy) { // Get core information. StringRef Name = BTy->getName(); // Add name if not anonymous or intermediate type. @@ -871,14 +870,14 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDBasicType *BTy) { addUInt(Buffer, dwarf::DW_AT_byte_size, None, Size); } -void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDDerivedType *DTy) { +void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy) { // Get core information. StringRef Name = DTy->getName(); uint64_t Size = DTy->getSizeInBits() >> 3; uint16_t Tag = Buffer.getTag(); // Map to main type, void will not have a type. - const MDType *FromTy = resolve(DTy->getBaseType()); + const DIType *FromTy = resolve(DTy->getBaseType()); if (FromTy) addType(Buffer, FromTy); @@ -894,15 +893,15 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDDerivedType *DTy) { if (Tag == dwarf::DW_TAG_ptr_to_member_type) addDIEEntry( Buffer, dwarf::DW_AT_containing_type, - *getOrCreateTypeDIE(resolve(cast<MDDerivedType>(DTy)->getClassType()))); + *getOrCreateTypeDIE(resolve(cast<DIDerivedType>(DTy)->getClassType()))); // Add source line info if available and TyDesc is not a forward declaration. if (!DTy->isForwardDecl()) addSourceLine(Buffer, DTy); } -void DwarfUnit::constructSubprogramArguments(DIE &Buffer, MDTypeRefArray Args) { +void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args) { for (unsigned i = 1, N = Args.size(); i < N; ++i) { - const MDType *Ty = resolve(Args[i]); + const DIType *Ty = resolve(Args[i]); if (!Ty) { assert(i == N-1 && "Unspecified parameter must be the last argument"); createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, Buffer); @@ -915,9 +914,9 @@ void DwarfUnit::constructSubprogramArguments(DIE &Buffer, MDTypeRefArray Args) { } } -void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDSubroutineType *CTy) { +void DwarfUnit::constructTypeDIE(DIE &Buffer, const DISubroutineType *CTy) { // Add return type. A void return won't have a type. - auto Elements = cast<MDSubroutineType>(CTy)->getTypeArray(); + auto Elements = cast<DISubroutineType>(CTy)->getTypeArray(); if (Elements.size()) if (auto RTy = resolve(Elements[0])) addType(Buffer, RTy); @@ -943,7 +942,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDSubroutineType *CTy) { addFlag(Buffer, dwarf::DW_AT_rvalue_reference); } -void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { +void DwarfUnit::constructTypeDIE(DIE &Buffer, const DICompositeType *CTy) { // Add name if not anonymous or intermediate type. StringRef Name = CTy->getName(); @@ -961,13 +960,13 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { case dwarf::DW_TAG_union_type: case dwarf::DW_TAG_class_type: { // Add elements to structure type. - DebugNodeArray Elements = CTy->getElements(); + DINodeArray Elements = CTy->getElements(); for (const auto *Element : Elements) { if (!Element) continue; - if (auto *SP = dyn_cast<MDSubprogram>(Element)) + if (auto *SP = dyn_cast<DISubprogram>(Element)) getOrCreateSubprogramDIE(SP); - else if (auto *DDTy = dyn_cast<MDDerivedType>(Element)) { + else if (auto *DDTy = dyn_cast<DIDerivedType>(Element)) { if (DDTy->getTag() == dwarf::DW_TAG_friend) { DIE &ElemDie = createAndAddDIE(dwarf::DW_TAG_friend, Buffer); addType(ElemDie, resolve(DDTy->getBaseType()), dwarf::DW_AT_friend); @@ -976,7 +975,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { } else { constructMemberDIE(Buffer, DDTy); } - } else if (auto *Property = dyn_cast<MDObjCProperty>(Element)) { + } else if (auto *Property = dyn_cast<DIObjCProperty>(Element)) { DIE &ElemDie = createAndAddDIE(Property->getTag(), Buffer); StringRef PropertyName = Property->getName(); addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName); @@ -1007,7 +1006,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { // This is outside the DWARF spec, but GDB expects a DW_AT_containing_type // inside C++ composite types to point to the base class with the vtable. if (auto *ContainingType = - dyn_cast_or_null<MDCompositeType>(resolve(CTy->getVTableHolder()))) + dyn_cast_or_null<DICompositeType>(resolve(CTy->getVTableHolder()))) addDIEEntry(Buffer, dwarf::DW_AT_containing_type, *getOrCreateTypeDIE(ContainingType)); @@ -1058,7 +1057,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { } void DwarfUnit::constructTemplateTypeParameterDIE( - DIE &Buffer, const MDTemplateTypeParameter *TP) { + DIE &Buffer, const DITemplateTypeParameter *TP) { DIE &ParamDIE = createAndAddDIE(dwarf::DW_TAG_template_type_parameter, Buffer); // Add the type if it exists, it could be void and therefore no type. @@ -1069,7 +1068,7 @@ void DwarfUnit::constructTemplateTypeParameterDIE( } void DwarfUnit::constructTemplateValueParameterDIE( - DIE &Buffer, const MDTemplateValueParameter *VP) { + DIE &Buffer, const DITemplateValueParameter *VP) { DIE &ParamDIE = createAndAddDIE(VP->getTag(), Buffer); // Add the type if there is one, template template and template parameter @@ -1100,7 +1099,7 @@ void DwarfUnit::constructTemplateValueParameterDIE( } } -DIE *DwarfUnit::getOrCreateNameSpace(const MDNamespace *NS) { +DIE *DwarfUnit::getOrCreateNameSpace(const DINamespace *NS) { // Construct the context before querying for the existence of the DIE in case // such construction creates the DIE. DIE *ContextDIE = getOrCreateContextDIE(NS->getScope()); @@ -1120,7 +1119,7 @@ DIE *DwarfUnit::getOrCreateNameSpace(const MDNamespace *NS) { return &NDie; } -DIE *DwarfUnit::getOrCreateSubprogramDIE(const MDSubprogram *SP, bool Minimal) { +DIE *DwarfUnit::getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal) { // Construct the context before querying for the existence of the DIE in case // such construction creates the DIE (as is the case for member function // declarations). @@ -1151,7 +1150,7 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(const MDSubprogram *SP, bool Minimal) { return &SPDie; } -bool DwarfUnit::applySubprogramDefinitionAttributes(const MDSubprogram *SP, +bool DwarfUnit::applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie) { DIE *DeclDie = nullptr; StringRef DeclLinkageName; @@ -1183,7 +1182,7 @@ bool DwarfUnit::applySubprogramDefinitionAttributes(const MDSubprogram *SP, return true; } -void DwarfUnit::applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie, +void DwarfUnit::applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal) { if (!Minimal) if (applySubprogramDefinitionAttributes(SP, SPDie)) @@ -1207,7 +1206,7 @@ void DwarfUnit::applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie, Language == dwarf::DW_LANG_ObjC)) addFlag(SPDie, dwarf::DW_AT_prototyped); - const MDSubroutineType *SPTy = SP->getType(); + const DISubroutineType *SPTy = SP->getType(); assert(SPTy->getTag() == dwarf::DW_TAG_subroutine_type && "the type of a subprogram should be a subroutine"); @@ -1269,7 +1268,7 @@ void DwarfUnit::applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie, addFlag(SPDie, dwarf::DW_AT_explicit); } -void DwarfUnit::constructSubrangeDIE(DIE &Buffer, const MDSubrange *SR, +void DwarfUnit::constructSubrangeDIE(DIE &Buffer, const DISubrange *SR, DIE *IndexTy) { DIE &DW_Subrange = createAndAddDIE(dwarf::DW_TAG_subrange_type, Buffer); addDIEEntry(DW_Subrange, dwarf::DW_AT_type, *IndexTy); @@ -1303,7 +1302,7 @@ DIE *DwarfUnit::getIndexTyDie() { return IndexTyDie; } -void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { +void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy) { if (CTy->isVector()) addFlag(Buffer, dwarf::DW_AT_GNU_vector); @@ -1316,21 +1315,21 @@ void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { DIE *IdxTy = getIndexTyDie(); // Add subranges to array type. - DebugNodeArray Elements = CTy->getElements(); + DINodeArray Elements = CTy->getElements(); for (unsigned i = 0, N = Elements.size(); i < N; ++i) { // FIXME: Should this really be such a loose cast? - if (auto *Element = dyn_cast_or_null<DebugNode>(Elements[i])) + if (auto *Element = dyn_cast_or_null<DINode>(Elements[i])) if (Element->getTag() == dwarf::DW_TAG_subrange_type) - constructSubrangeDIE(Buffer, cast<MDSubrange>(Element), IdxTy); + constructSubrangeDIE(Buffer, cast<DISubrange>(Element), IdxTy); } } -void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { - DebugNodeArray Elements = CTy->getElements(); +void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy) { + DINodeArray Elements = CTy->getElements(); // Add enumerators to enumeration type. for (unsigned i = 0, N = Elements.size(); i < N; ++i) { - auto *Enum = dyn_cast_or_null<MDEnumerator>(Elements[i]); + auto *Enum = dyn_cast_or_null<DIEnumerator>(Elements[i]); if (Enum) { DIE &Enumerator = createAndAddDIE(dwarf::DW_TAG_enumerator, Buffer); StringRef Name = Enum->getName(); @@ -1340,7 +1339,7 @@ void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { Value); } } - const MDType *DTy = resolve(CTy->getBaseType()); + const DIType *DTy = resolve(CTy->getBaseType()); if (DTy) { addType(Buffer, DTy); addFlag(Buffer, dwarf::DW_AT_enum_class); @@ -1351,7 +1350,7 @@ void DwarfUnit::constructContainingTypeDIEs() { for (auto CI = ContainingTypeMap.begin(), CE = ContainingTypeMap.end(); CI != CE; ++CI) { DIE &SPDie = *CI->first; - const DebugNode *D = CI->second; + const DINode *D = CI->second; if (!D) continue; DIE *NDie = getDIE(D); @@ -1361,7 +1360,7 @@ void DwarfUnit::constructContainingTypeDIEs() { } } -void DwarfUnit::constructMemberDIE(DIE &Buffer, const MDDerivedType *DT) { +void DwarfUnit::constructMemberDIE(DIE &Buffer, const DIDerivedType *DT) { DIE &MemberDie = createAndAddDIE(DT->getTag(), Buffer); StringRef Name = DT->getName(); if (!Name.empty()) @@ -1449,7 +1448,7 @@ void DwarfUnit::constructMemberDIE(DIE &Buffer, const MDDerivedType *DT) { addFlag(MemberDie, dwarf::DW_AT_artificial); } -DIE *DwarfUnit::getOrCreateStaticMemberDIE(const MDDerivedType *DT) { +DIE *DwarfUnit::getOrCreateStaticMemberDIE(const DIDerivedType *DT) { if (!DT) return nullptr; @@ -1464,7 +1463,7 @@ DIE *DwarfUnit::getOrCreateStaticMemberDIE(const MDDerivedType *DT) { DIE &StaticMemberDIE = createAndAddDIE(DT->getTag(), *ContextDIE, DT); - const MDType *Ty = resolve(DT->getBaseType()); + const DIType *Ty = resolve(DT->getBaseType()); addString(StaticMemberDIE, dwarf::DW_AT_name, DT->getName()); addType(StaticMemberDIE, Ty); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h index 1cbf3489b1b..a0ea3c870c3 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h @@ -71,7 +71,7 @@ protected: unsigned UniqueID; /// MDNode for the compile unit. - const MDCompileUnit *CUNode; + const DICompileUnit *CUNode; /// Unit debug information entry. DIE UnitDie; @@ -106,7 +106,7 @@ protected: /// This map is used to keep track of subprogram DIEs that need /// DW_AT_containing_type attribute. This attribute points to a DIE that /// corresponds to the MDNode mapped with the subprogram DIE. - DenseMap<DIE *, const DebugNode *> ContainingTypeMap; + DenseMap<DIE *, const DINode *> ContainingTypeMap; // All DIEValues are allocated through this allocator. BumpPtrAllocator DIEValueAllocator; @@ -117,7 +117,7 @@ protected: /// The section this unit will be emitted in. const MCSection *Section; - DwarfUnit(unsigned UID, dwarf::Tag, const MDCompileUnit *CU, AsmPrinter *A, + DwarfUnit(unsigned UID, dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU); /// \brief Add a string attribute data and value. @@ -127,7 +127,7 @@ protected: void addIndexedString(DIE &Die, dwarf::Attribute Attribute, StringRef Str); - bool applySubprogramDefinitionAttributes(const MDSubprogram *SP, DIE &SPDie); + bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie); public: virtual ~DwarfUnit(); @@ -143,7 +143,7 @@ public: AsmPrinter* getAsmPrinter() const { return Asm; } unsigned getUniqueID() const { return UniqueID; } uint16_t getLanguage() const { return CUNode->getSourceLanguage(); } - const MDCompileUnit *getCUNode() const { return CUNode; } + const DICompileUnit *getCUNode() const { return CUNode; } DIE &getUnitDie() { return UnitDie; } unsigned getDebugInfoOffset() const { return DebugInfoOffset; } @@ -159,15 +159,15 @@ public: /// metadata level because DIEs may not currently have been added to the /// parent context and walking the DIEs looking for names is more expensive /// than walking the metadata. - std::string getParentContextString(const MDScope *Context) const; + std::string getParentContextString(const DIScope *Context) const; /// Add a new global name to the compile unit. - virtual void addGlobalName(StringRef Name, DIE &Die, const MDScope *Context) { + virtual void addGlobalName(StringRef Name, DIE &Die, const DIScope *Context) { } /// Add a new global type to the compile unit. - virtual void addGlobalType(const MDType *Ty, const DIE &Die, - const MDScope *Context) {} + virtual void addGlobalType(const DIType *Ty, const DIE &Die, + const DIScope *Context) {} /// \brief Add a new name to the namespace accelerator table. void addAccelNamespace(StringRef Name, const DIE &Die); @@ -177,7 +177,7 @@ public: /// We delegate the request to DwarfDebug when the MDNode can be part of the /// type system, since DIEs for the type system can be shared across CUs and /// the mappings are kept in DwarfDebug. - DIE *getDIE(const DebugNode *D) const; + DIE *getDIE(const DINode *D) const; /// \brief Returns a fresh newly allocated DIELoc. DIELoc *getDIELoc() { return new (DIEValueAllocator) DIELoc(); } @@ -187,7 +187,7 @@ public: /// We delegate the request to DwarfDebug when the MDNode can be part of the /// type system, since DIEs for the type system can be shared across CUs and /// the mappings are kept in DwarfDebug. - void insertDIE(const DebugNode *Desc, DIE *D); + void insertDIE(const DINode *Desc, DIE *D); /// \brief Add a flag that is true to the DIE. void addFlag(DIE &Die, dwarf::Attribute Attribute); @@ -246,17 +246,17 @@ public: /// \brief Add location information to specified debug information entry. void addSourceLine(DIE &Die, unsigned Line, StringRef File, StringRef Directory); - void addSourceLine(DIE &Die, const MDLocalVariable *V); - void addSourceLine(DIE &Die, const MDGlobalVariable *G); - void addSourceLine(DIE &Die, const MDSubprogram *SP); - void addSourceLine(DIE &Die, const MDType *Ty); - void addSourceLine(DIE &Die, const MDNamespace *NS); - void addSourceLine(DIE &Die, const MDObjCProperty *Ty); + void addSourceLine(DIE &Die, const DILocalVariable *V); + void addSourceLine(DIE &Die, const DIGlobalVariable *G); + void addSourceLine(DIE &Die, const DISubprogram *SP); + void addSourceLine(DIE &Die, const DIType *Ty); + void addSourceLine(DIE &Die, const DINamespace *NS); + void addSourceLine(DIE &Die, const DIObjCProperty *Ty); /// \brief Add constant value entry in variable DIE. - void addConstantValue(DIE &Die, const MachineOperand &MO, const MDType *Ty); - void addConstantValue(DIE &Die, const ConstantInt *CI, const MDType *Ty); - void addConstantValue(DIE &Die, const APInt &Val, const MDType *Ty); + void addConstantValue(DIE &Die, const MachineOperand &MO, const DIType *Ty); + void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty); + void addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty); void addConstantValue(DIE &Die, const APInt &Val, bool Unsigned); void addConstantValue(DIE &Die, bool Unsigned, uint64_t Val); @@ -268,7 +268,7 @@ public: void addLinkageName(DIE &Die, StringRef LinkageName); /// \brief Add template parameters in buffer. - void addTemplateParams(DIE &Buffer, DebugNodeArray TParams); + void addTemplateParams(DIE &Buffer, DINodeArray TParams); /// \brief Add register operand. /// \returns false if the register does not exist, e.g., because it was never @@ -294,33 +294,33 @@ public: /// /// This takes and attribute parameter because DW_AT_friend attributes are /// also type references. - void addType(DIE &Entity, const MDType *Ty, + void addType(DIE &Entity, const DIType *Ty, dwarf::Attribute Attribute = dwarf::DW_AT_type); - DIE *getOrCreateNameSpace(const MDNamespace *NS); - DIE *getOrCreateSubprogramDIE(const MDSubprogram *SP, bool Minimal = false); + DIE *getOrCreateNameSpace(const DINamespace *NS); + DIE *getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal = false); - void applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie, + void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal = false); /// \brief Find existing DIE or create new DIE for the given type. DIE *getOrCreateTypeDIE(const MDNode *N); /// \brief Get context owner's DIE. - DIE *createTypeDIE(const MDCompositeType *Ty); + DIE *createTypeDIE(const DICompositeType *Ty); /// \brief Get context owner's DIE. - DIE *getOrCreateContextDIE(const MDScope *Context); + DIE *getOrCreateContextDIE(const DIScope *Context); /// \brief Construct DIEs for types that contain vtables. void constructContainingTypeDIEs(); /// \brief Construct function argument DIEs. - void constructSubprogramArguments(DIE &Buffer, MDTypeRefArray Args); + void constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args); /// Create a DIE with the given Tag, add the DIE to its parent, and /// call insertDIE if MD is not null. - DIE &createAndAddDIE(unsigned Tag, DIE &Parent, const DebugNode *N = nullptr); + DIE &createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N = nullptr); /// Compute the size of a header for this unit, not including the initial /// length field. @@ -335,11 +335,11 @@ public: virtual DwarfCompileUnit &getCU() = 0; - void constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy); + void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy); protected: /// \brief Create new static data member DIE. - DIE *getOrCreateStaticMemberDIE(const MDDerivedType *DT); + DIE *getOrCreateStaticMemberDIE(const DIDerivedType *DT); /// Look up the source ID with the given directory and source file names. If /// none currently exists, create a new ID and insert it in the line table. @@ -347,22 +347,22 @@ protected: /// \brief Look in the DwarfDebug map for the MDNode that corresponds to the /// reference. - template <typename T> T *resolve(TypedDebugNodeRef<T> Ref) const { + template <typename T> T *resolve(TypedDINodeRef<T> Ref) const { return DD->resolve(Ref); } private: - void constructTypeDIE(DIE &Buffer, const MDBasicType *BTy); - void constructTypeDIE(DIE &Buffer, const MDDerivedType *DTy); - void constructTypeDIE(DIE &Buffer, const MDSubroutineType *DTy); - void constructSubrangeDIE(DIE &Buffer, const MDSubrange *SR, DIE *IndexTy); - void constructArrayTypeDIE(DIE &Buffer, const MDCompositeType *CTy); - void constructEnumTypeDIE(DIE &Buffer, const MDCompositeType *CTy); - void constructMemberDIE(DIE &Buffer, const MDDerivedType *DT); + void constructTypeDIE(DIE &Buffer, const DIBasicType *BTy); + void constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy); + void constructTypeDIE(DIE &Buffer, const DISubroutineType *DTy); + void constructSubrangeDIE(DIE &Buffer, const DISubrange *SR, DIE *IndexTy); + void constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy); + void constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy); + void constructMemberDIE(DIE &Buffer, const DIDerivedType *DT); void constructTemplateTypeParameterDIE(DIE &Buffer, - const MDTemplateTypeParameter *TP); + const DITemplateTypeParameter *TP); void constructTemplateValueParameterDIE(DIE &Buffer, - const MDTemplateValueParameter *TVP); + const DITemplateValueParameter *TVP); /// \brief Return the default lower bound for an array. /// @@ -391,7 +391,7 @@ private: /// If this is a named finished type then include it in the list of types for /// the accelerator tables. - void updateAcceleratorTables(const MDScope *Context, const MDType *Ty, + void updateAcceleratorTables(const DIScope *Context, const DIType *Ty, const DIE &TyDIE); virtual bool isDwoUnit() const = 0; diff --git a/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp b/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp index ff217813eeb..f394aba9131 100644 --- a/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp @@ -20,11 +20,11 @@ namespace llvm { StringRef WinCodeViewLineTables::getFullFilepath(const MDNode *S) { assert(S); - assert((isa<MDCompileUnit>(S) || isa<MDFile>(S) || isa<MDSubprogram>(S) || - isa<MDLexicalBlockBase>(S)) && + assert((isa<DICompileUnit>(S) || isa<DIFile>(S) || isa<DISubprogram>(S) || + isa<DILexicalBlockBase>(S)) && "Unexpected scope info"); - auto *Scope = cast<MDScope>(S); + auto *Scope = cast<DIScope>(S); StringRef Dir = Scope->getDirectory(), Filename = Scope->getFilename(); char *&Result = DirAndFilenameToFilepathMap[std::make_pair(Dir, Filename)]; diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp index c7e7e58f397..59a92890f5a 100644 --- a/llvm/lib/CodeGen/InlineSpiller.cpp +++ b/llvm/lib/CodeGen/InlineSpiller.cpp @@ -1232,7 +1232,7 @@ void InlineSpiller::spillAroundUses(unsigned Reg) { DebugLoc DL = MI->getDebugLoc(); DEBUG(dbgs() << "Modifying debug info due to spill:" << "\t" << *MI); MachineBasicBlock *MBB = MI->getParent(); - assert(cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) && + assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) && "Expected inlined-at fields to agree"); BuildMI(*MBB, MBB->erase(MI), DL, TII.get(TargetOpcode::DBG_VALUE)) .addFrameIndex(StackSlot) diff --git a/llvm/lib/CodeGen/LexicalScopes.cpp b/llvm/lib/CodeGen/LexicalScopes.cpp index d6998d6e1c5..be61a20424b 100644 --- a/llvm/lib/CodeGen/LexicalScopes.cpp +++ b/llvm/lib/CodeGen/LexicalScopes.cpp @@ -59,10 +59,10 @@ void LexicalScopes::extractLexicalScopes( for (const auto &MBB : *MF) { const MachineInstr *RangeBeginMI = nullptr; const MachineInstr *PrevMI = nullptr; - const MDLocation *PrevDL = nullptr; + const DILocation *PrevDL = nullptr; for (const auto &MInsn : MBB) { // Check if instruction has valid location information. - const MDLocation *MIDL = MInsn.getDebugLoc(); + const DILocation *MIDL = MInsn.getDebugLoc(); if (!MIDL) { PrevMI = &MInsn; continue; @@ -106,14 +106,14 @@ void LexicalScopes::extractLexicalScopes( /// findLexicalScope - Find lexical scope, either regular or inlined, for the /// given DebugLoc. Return NULL if not found. -LexicalScope *LexicalScopes::findLexicalScope(const MDLocation *DL) { - MDLocalScope *Scope = DL->getScope(); +LexicalScope *LexicalScopes::findLexicalScope(const DILocation *DL) { + DILocalScope *Scope = DL->getScope(); if (!Scope) return nullptr; // The scope that we were created with could have an extra file - which // isn't what we care about in this case. - if (auto *File = dyn_cast<MDLexicalBlockFile>(Scope)) + if (auto *File = dyn_cast<DILexicalBlockFile>(Scope)) Scope = File->getScope(); if (auto *IA = DL->getInlinedAt()) { @@ -125,8 +125,8 @@ LexicalScope *LexicalScopes::findLexicalScope(const MDLocation *DL) { /// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If /// not available then create new lexical scope. -LexicalScope *LexicalScopes::getOrCreateLexicalScope(const MDLocalScope *Scope, - const MDLocation *IA) { +LexicalScope *LexicalScopes::getOrCreateLexicalScope(const DILocalScope *Scope, + const DILocation *IA) { if (IA) { // Create an abstract scope for inlined function. getOrCreateAbstractScope(Scope); @@ -139,17 +139,17 @@ LexicalScope *LexicalScopes::getOrCreateLexicalScope(const MDLocalScope *Scope, /// getOrCreateRegularScope - Find or create a regular lexical scope. LexicalScope * -LexicalScopes::getOrCreateRegularScope(const MDLocalScope *Scope) { - if (auto *File = dyn_cast<MDLexicalBlockFile>(Scope)) +LexicalScopes::getOrCreateRegularScope(const DILocalScope *Scope) { + if (auto *File = dyn_cast<DILexicalBlockFile>(Scope)) Scope = File->getScope(); auto I = LexicalScopeMap.find(Scope); if (I != LexicalScopeMap.end()) return &I->second; - // FIXME: Should the following dyn_cast be MDLexicalBlock? + // FIXME: Should the following dyn_cast be DILexicalBlock? LexicalScope *Parent = nullptr; - if (auto *Block = dyn_cast<MDLexicalBlockBase>(Scope)) + if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope)) Parent = getOrCreateLexicalScope(Block->getScope()); I = LexicalScopeMap.emplace(std::piecewise_construct, std::forward_as_tuple(Scope), @@ -157,7 +157,7 @@ LexicalScopes::getOrCreateRegularScope(const MDLocalScope *Scope) { false)).first; if (!Parent) { - assert(cast<MDSubprogram>(Scope)->describes(MF->getFunction())); + assert(cast<DISubprogram>(Scope)->describes(MF->getFunction())); assert(!CurrentFnLexicalScope); CurrentFnLexicalScope = &I->second; } @@ -167,15 +167,15 @@ LexicalScopes::getOrCreateRegularScope(const MDLocalScope *Scope) { /// getOrCreateInlinedScope - Find or create an inlined lexical scope. LexicalScope * -LexicalScopes::getOrCreateInlinedScope(const MDLocalScope *Scope, - const MDLocation *InlinedAt) { - std::pair<const MDLocalScope *, const MDLocation *> P(Scope, InlinedAt); +LexicalScopes::getOrCreateInlinedScope(const DILocalScope *Scope, + const DILocation *InlinedAt) { + std::pair<const DILocalScope *, const DILocation *> P(Scope, InlinedAt); auto I = InlinedLexicalScopeMap.find(P); if (I != InlinedLexicalScopeMap.end()) return &I->second; LexicalScope *Parent; - if (auto *Block = dyn_cast<MDLexicalBlockBase>(Scope)) + if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope)) Parent = getOrCreateInlinedScope(Block->getScope(), InlinedAt); else Parent = getOrCreateLexicalScope(InlinedAt); @@ -190,25 +190,25 @@ LexicalScopes::getOrCreateInlinedScope(const MDLocalScope *Scope, /// getOrCreateAbstractScope - Find or create an abstract lexical scope. LexicalScope * -LexicalScopes::getOrCreateAbstractScope(const MDLocalScope *Scope) { +LexicalScopes::getOrCreateAbstractScope(const DILocalScope *Scope) { assert(Scope && "Invalid Scope encoding!"); - if (auto *File = dyn_cast<MDLexicalBlockFile>(Scope)) + if (auto *File = dyn_cast<DILexicalBlockFile>(Scope)) Scope = File->getScope(); auto I = AbstractScopeMap.find(Scope); if (I != AbstractScopeMap.end()) return &I->second; - // FIXME: Should the following isa be MDLexicalBlock? + // FIXME: Should the following isa be DILexicalBlock? LexicalScope *Parent = nullptr; - if (auto *Block = dyn_cast<MDLexicalBlockBase>(Scope)) + if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope)) Parent = getOrCreateAbstractScope(Block->getScope()); I = AbstractScopeMap.emplace(std::piecewise_construct, std::forward_as_tuple(Scope), std::forward_as_tuple(Parent, Scope, nullptr, true)).first; - if (isa<MDSubprogram>(Scope)) + if (isa<DISubprogram>(Scope)) AbstractScopesList.push_back(&I->second); return &I->second; } @@ -269,7 +269,7 @@ void LexicalScopes::assignInstructionRanges( /// have machine instructions that belong to lexical scope identified by /// DebugLoc. void LexicalScopes::getMachineBasicBlocks( - const MDLocation *DL, SmallPtrSetImpl<const MachineBasicBlock *> &MBBs) { + const DILocation *DL, SmallPtrSetImpl<const MachineBasicBlock *> &MBBs) { MBBs.clear(); LexicalScope *Scope = getOrCreateLexicalScope(DL); if (!Scope) @@ -292,7 +292,7 @@ void LexicalScopes::getMachineBasicBlocks( /// dominates - Return true if DebugLoc's lexical scope dominates at least one /// machine instruction's lexical scope in a given machine basic block. -bool LexicalScopes::dominates(const MDLocation *DL, MachineBasicBlock *MBB) { +bool LexicalScopes::dominates(const DILocation *DL, MachineBasicBlock *MBB) { LexicalScope *Scope = getOrCreateLexicalScope(DL); if (!Scope) return false; @@ -304,7 +304,7 @@ bool LexicalScopes::dominates(const MDLocation *DL, MachineBasicBlock *MBB) { bool Result = false; for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); I != E; ++I) { - if (const MDLocation *IDL = I->getDebugLoc()) + if (const DILocation *IDL = I->getDebugLoc()) if (LexicalScope *IScope = getOrCreateLexicalScope(IDL)) if (Scope->dominates(IScope)) return true; diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp index df48c53f16b..15715513452 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.cpp +++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp @@ -158,7 +158,7 @@ public: UserValue *getNext() const { return next; } /// match - Does this UserValue match the parameters? - bool match(const MDNode *Var, const MDNode *Expr, const MDLocation *IA, + bool match(const MDNode *Var, const MDNode *Expr, const DILocation *IA, unsigned Offset, bool indirect) const { return Var == Variable && Expr == Expression && dl->getInlinedAt() == IA && Offset == offset && indirect == IsIndirect; @@ -362,7 +362,7 @@ static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS, if (!DL) return; - auto *Scope = cast<MDScope>(DL.getScope()); + auto *Scope = cast<DIScope>(DL.getScope()); // Omit the directory, because it's likely to be long and uninteresting. CommentOS << Scope->getFilename(); CommentOS << ':' << DL.getLine(); @@ -378,8 +378,8 @@ static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS, CommentOS << " ]"; } -static void printExtendedName(raw_ostream &OS, const MDLocalVariable *V, - const MDLocation *DL) { +static void printExtendedName(raw_ostream &OS, const DILocalVariable *V, + const DILocation *DL) { const LLVMContext &Ctx = V->getContext(); StringRef Res = V->getName(); if (!Res.empty()) @@ -394,7 +394,7 @@ static void printExtendedName(raw_ostream &OS, const MDLocalVariable *V, } void UserValue::print(raw_ostream &OS, const TargetRegisterInfo *TRI) { - auto *DV = cast<MDLocalVariable>(Variable); + auto *DV = cast<DILocalVariable>(Variable); OS << "!\""; printExtendedName(OS, DV, dl); @@ -981,7 +981,7 @@ void UserValue::insertDebugValue(MachineBasicBlock *MBB, SlotIndex Idx, MachineOperand &Loc = locations[LocNo]; ++NumInsertedDebugValues; - assert(cast<MDLocalVariable>(Variable) + assert(cast<DILocalVariable>(Variable) ->isValidLocationForIntrinsic(getDebugLoc()) && "Expected inlined-at fields to agree"); if (Loc.isReg()) diff --git a/llvm/lib/CodeGen/LiveDebugVariables.h b/llvm/lib/CodeGen/LiveDebugVariables.h index 88a34ddcc12..ac2d1a136bc 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.h +++ b/llvm/lib/CodeGen/LiveDebugVariables.h @@ -33,7 +33,7 @@ class VirtRegMap; class LiveDebugVariables : public MachineFunctionPass { void *pImpl; - DenseMap<const Function *, MDSubprogram *> FunctionDIs; + DenseMap<const Function *, DISubprogram *> FunctionDIs; public: static char ID; // Pass identification, replacement for typeid diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 86d33b0c0b0..7f3c3e935a2 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1619,7 +1619,7 @@ void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const { } if (isDebugValue() && MO.isMetadata()) { // Pretty print DBG_VALUE instructions. - auto *DIV = dyn_cast<MDLocalVariable>(MO.getMetadata()); + auto *DIV = dyn_cast<DILocalVariable>(MO.getMetadata()); if (DIV && !DIV->getName().empty()) OS << "!\"" << DIV->getName() << '\"'; else @@ -1710,7 +1710,7 @@ void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const { // Print debug location information. if (isDebugValue() && getOperand(e - 2).isMetadata()) { if (!HaveSemi) OS << ";"; - auto *DV = cast<MDLocalVariable>(getOperand(e - 2).getMetadata()); + auto *DV = cast<DILocalVariable>(getOperand(e - 2).getMetadata()); OS << " line no:" << DV->getLine(); if (auto *InlinedAt = debugLoc->getInlinedAt()) { DebugLoc InlinedAtDL(InlinedAt); diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp index c311c7ba2b4..fd3d4d78968 100644 --- a/llvm/lib/CodeGen/RegAllocFast.cpp +++ b/llvm/lib/CodeGen/RegAllocFast.cpp @@ -302,7 +302,7 @@ void RAFast::spillVirtReg(MachineBasicBlock::iterator MI, bool IsIndirect = DBG->isIndirectDebugValue(); uint64_t Offset = IsIndirect ? DBG->getOperand(1).getImm() : 0; DebugLoc DL = DBG->getDebugLoc(); - assert(cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) && + assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) && "Expected inlined-at fields to agree"); MachineInstr *NewDV = BuildMI(*MBB, MI, DL, TII->get(TargetOpcode::DBG_VALUE)) @@ -874,7 +874,7 @@ void RAFast::AllocateBasicBlock() { DebugLoc DL = MI->getDebugLoc(); MachineBasicBlock *MBB = MI->getParent(); assert( - cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) && + cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) && "Expected inlined-at fields to agree"); MachineInstr *NewDV = BuildMI(*MBB, MBB->erase(MI), DL, TII->get(TargetOpcode::DBG_VALUE)) diff --git a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp index ff81fd1e299..7abc0c4e791 100644 --- a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp @@ -650,7 +650,7 @@ InstrEmitter::EmitDbgValue(SDDbgValue *SD, MDNode *Var = SD->getVariable(); MDNode *Expr = SD->getExpression(); DebugLoc DL = SD->getDebugLoc(); - assert(cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) && + assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) && "Expected inlined-at fields to agree"); if (SD->getKind() == SDDbgValue::FRAMEIX) { diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 84416966da8..d289406e6e9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -5978,7 +5978,7 @@ SDNode *SelectionDAG::getNodeIfExists(unsigned Opcode, SDVTList VTList, SDDbgValue *SelectionDAG::getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N, unsigned R, bool IsIndirect, uint64_t Off, DebugLoc DL, unsigned O) { - assert(cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) && + assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) && "Expected inlined-at fields to agree"); return new (Allocator) SDDbgValue(Var, Expr, N, R, IsIndirect, Off, DL, O); } @@ -5987,7 +5987,7 @@ SDDbgValue *SelectionDAG::getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N, SDDbgValue *SelectionDAG::getConstantDbgValue(MDNode *Var, MDNode *Expr, const Value *C, uint64_t Off, DebugLoc DL, unsigned O) { - assert(cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) && + assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) && "Expected inlined-at fields to agree"); return new (Allocator) SDDbgValue(Var, Expr, C, Off, DL, O); } @@ -5996,7 +5996,7 @@ SDDbgValue *SelectionDAG::getConstantDbgValue(MDNode *Var, MDNode *Expr, SDDbgValue *SelectionDAG::getFrameIndexDbgValue(MDNode *Var, MDNode *Expr, unsigned FI, uint64_t Off, DebugLoc DL, unsigned O) { - assert(cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) && + assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) && "Expected inlined-at fields to agree"); return new (Allocator) SDDbgValue(Var, Expr, FI, Off, DL, O); } diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 08bdccdeb07..db41c407b03 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -999,8 +999,8 @@ void SelectionDAGBuilder::resolveDanglingDebugInfo(const Value *V, const DbgValueInst *DI = DDI.getDI(); DebugLoc dl = DDI.getdl(); unsigned DbgSDNodeOrder = DDI.getSDNodeOrder(); - MDLocalVariable *Variable = DI->getVariable(); - MDExpression *Expr = DI->getExpression(); + DILocalVariable *Variable = DI->getVariable(); + DIExpression *Expr = DI->getExpression(); assert(Variable->isValidLocationForIntrinsic(dl) && "Expected inlined-at fields to agree"); uint64_t Offset = DI->getOffset(); @@ -3980,8 +3980,8 @@ static unsigned getTruncatedArgReg(const SDValue &N) { /// argument, create the corresponding DBG_VALUE machine instruction for it now. /// At the end of instruction selection, they will be inserted to the entry BB. bool SelectionDAGBuilder::EmitFuncArgumentDbgValue( - const Value *V, MDLocalVariable *Variable, MDExpression *Expr, - MDLocation *DL, int64_t Offset, bool IsIndirect, const SDValue &N) { + const Value *V, DILocalVariable *Variable, DIExpression *Expr, + DILocation *DL, int64_t Offset, bool IsIndirect, const SDValue &N) { const Argument *Arg = dyn_cast<Argument>(V); if (!Arg) return false; @@ -4175,8 +4175,8 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) { } case Intrinsic::dbg_declare: { const DbgDeclareInst &DI = cast<DbgDeclareInst>(I); - MDLocalVariable *Variable = DI.getVariable(); - MDExpression *Expression = DI.getExpression(); + DILocalVariable *Variable = DI.getVariable(); + DIExpression *Expression = DI.getExpression(); const Value *Address = DI.getAddress(); assert(Variable && "Missing variable"); if (!Address) { @@ -4257,8 +4257,8 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) { const DbgValueInst &DI = cast<DbgValueInst>(I); assert(DI.getVariable() && "Missing variable"); - MDLocalVariable *Variable = DI.getVariable(); - MDExpression *Expression = DI.getExpression(); + DILocalVariable *Variable = DI.getVariable(); + DIExpression *Expression = DI.getExpression(); uint64_t Offset = DI.getOffset(); const Value *V = DI.getValue(); if (!V) diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h index 3e232e78c57..f812507fc09 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h @@ -866,8 +866,8 @@ private: /// EmitFuncArgumentDbgValue - If V is an function argument then create /// corresponding DBG_VALUE machine instruction for it now. At the end of /// instruction selection, they will be inserted to the entry BB. - bool EmitFuncArgumentDbgValue(const Value *V, MDLocalVariable *Variable, - MDExpression *Expr, MDLocation *DL, + bool EmitFuncArgumentDbgValue(const Value *V, DILocalVariable *Variable, + DIExpression *Expr, DILocation *DL, int64_t Offset, bool IsIndirect, const SDValue &N); diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp index 636c0a741a7..b7288338ecb 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp @@ -523,7 +523,7 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const { if (!G) return; - MDLocation *L = getDebugLoc(); + DILocation *L = getDebugLoc(); if (!L) return; diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 7213a5b9318..e208076a62e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -504,7 +504,7 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) { DebugLoc DL = MI->getDebugLoc(); bool IsIndirect = MI->isIndirectDebugValue(); unsigned Offset = IsIndirect ? MI->getOperand(1).getImm() : 0; - assert(cast<MDLocalVariable>(Variable)->isValidLocationForIntrinsic(DL) && + assert(cast<DILocalVariable>(Variable)->isValidLocationForIntrinsic(DL) && "Expected inlined-at fields to agree"); // Def is never a terminator here, so it is ok to increment InsertPos. BuildMI(*EntryMBB, ++InsertPos, DL, TII->get(TargetOpcode::DBG_VALUE), diff --git a/llvm/lib/CodeGen/StackColoring.cpp b/llvm/lib/CodeGen/StackColoring.cpp index 2bf2d642e1c..f9a2072ab31 100644 --- a/llvm/lib/CodeGen/StackColoring.cpp +++ b/llvm/lib/CodeGen/StackColoring.cpp @@ -464,7 +464,7 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) { continue; if (SlotRemap.count(VI.Slot)) { DEBUG(dbgs() << "Remapping debug info for [" - << cast<MDLocalVariable>(VI.Var)->getName() << "].\n"); + << cast<DILocalVariable>(VI.Var)->getName() << "].\n"); VI.Slot = SlotRemap[VI.Slot]; FixedDbg++; } diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index 0564513c94a..6dfb7fa6b0f 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -1375,7 +1375,7 @@ struct MDFieldPrinter { SlotTracker *Machine, const Module *Context) : Out(Out), TypePrinter(TypePrinter), Machine(Machine), Context(Context) { } - void printTag(const DebugNode *N); + void printTag(const DINode *N); void printString(StringRef Name, StringRef Value, bool ShouldSkipEmpty = true); void printMetadata(StringRef Name, const Metadata *MD, @@ -1390,7 +1390,7 @@ struct MDFieldPrinter { }; } // end namespace -void MDFieldPrinter::printTag(const DebugNode *N) { +void MDFieldPrinter::printTag(const DINode *N) { Out << FS << "tag: "; if (const char *Tag = dwarf::TagString(N->getTag())) Out << Tag; @@ -1447,11 +1447,11 @@ void MDFieldPrinter::printDIFlags(StringRef Name, unsigned Flags) { Out << FS << Name << ": "; SmallVector<unsigned, 8> SplitFlags; - unsigned Extra = DebugNode::splitFlags(Flags, SplitFlags); + unsigned Extra = DINode::splitFlags(Flags, SplitFlags); FieldSeparator FlagsFS(" | "); for (unsigned F : SplitFlags) { - const char *StringF = DebugNode::getFlagString(F); + const char *StringF = DINode::getFlagString(F); assert(StringF && "Expected valid flag"); Out << FlagsFS << StringF; } @@ -1472,10 +1472,10 @@ void MDFieldPrinter::printDwarfEnum(StringRef Name, IntTy Value, Out << Value; } -static void writeGenericDebugNode(raw_ostream &Out, const GenericDebugNode *N, - TypePrinting *TypePrinter, - SlotTracker *Machine, const Module *Context) { - Out << "!GenericDebugNode("; +static void writeGenericDINode(raw_ostream &Out, const GenericDINode *N, + TypePrinting *TypePrinter, SlotTracker *Machine, + const Module *Context) { + Out << "!GenericDINode("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printTag(N); Printer.printString("header", N->getHeader()); @@ -1491,10 +1491,10 @@ static void writeGenericDebugNode(raw_ostream &Out, const GenericDebugNode *N, Out << ")"; } -static void writeMDLocation(raw_ostream &Out, const MDLocation *DL, +static void writeDILocation(raw_ostream &Out, const DILocation *DL, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDLocation("; + Out << "!DILocation("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); // Always output the line, since 0 is a relevant and important value for it. Printer.printInt("line", DL->getLine(), /* ShouldSkipZero */ false); @@ -1504,27 +1504,27 @@ static void writeMDLocation(raw_ostream &Out, const MDLocation *DL, Out << ")"; } -static void writeMDSubrange(raw_ostream &Out, const MDSubrange *N, +static void writeDISubrange(raw_ostream &Out, const DISubrange *N, TypePrinting *, SlotTracker *, const Module *) { - Out << "!MDSubrange("; + Out << "!DISubrange("; MDFieldPrinter Printer(Out); Printer.printInt("count", N->getCount(), /* ShouldSkipZero */ false); Printer.printInt("lowerBound", N->getLowerBound()); Out << ")"; } -static void writeMDEnumerator(raw_ostream &Out, const MDEnumerator *N, +static void writeDIEnumerator(raw_ostream &Out, const DIEnumerator *N, TypePrinting *, SlotTracker *, const Module *) { - Out << "!MDEnumerator("; + Out << "!DIEnumerator("; MDFieldPrinter Printer(Out); Printer.printString("name", N->getName(), /* ShouldSkipEmpty */ false); Printer.printInt("value", N->getValue(), /* ShouldSkipZero */ false); Out << ")"; } -static void writeMDBasicType(raw_ostream &Out, const MDBasicType *N, +static void writeDIBasicType(raw_ostream &Out, const DIBasicType *N, TypePrinting *, SlotTracker *, const Module *) { - Out << "!MDBasicType("; + Out << "!DIBasicType("; MDFieldPrinter Printer(Out); if (N->getTag() != dwarf::DW_TAG_base_type) Printer.printTag(N); @@ -1536,10 +1536,10 @@ static void writeMDBasicType(raw_ostream &Out, const MDBasicType *N, Out << ")"; } -static void writeMDDerivedType(raw_ostream &Out, const MDDerivedType *N, +static void writeDIDerivedType(raw_ostream &Out, const DIDerivedType *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDDerivedType("; + Out << "!DIDerivedType("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printTag(N); Printer.printString("name", N->getName()); @@ -1556,10 +1556,10 @@ static void writeMDDerivedType(raw_ostream &Out, const MDDerivedType *N, Out << ")"; } -static void writeMDCompositeType(raw_ostream &Out, const MDCompositeType *N, +static void writeDICompositeType(raw_ostream &Out, const DICompositeType *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDCompositeType("; + Out << "!DICompositeType("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printTag(N); Printer.printString("name", N->getName()); @@ -1580,10 +1580,10 @@ static void writeMDCompositeType(raw_ostream &Out, const MDCompositeType *N, Out << ")"; } -static void writeMDSubroutineType(raw_ostream &Out, const MDSubroutineType *N, +static void writeDISubroutineType(raw_ostream &Out, const DISubroutineType *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDSubroutineType("; + Out << "!DISubroutineType("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printDIFlags("flags", N->getFlags()); Printer.printMetadata("types", N->getRawTypeArray(), @@ -1591,9 +1591,9 @@ static void writeMDSubroutineType(raw_ostream &Out, const MDSubroutineType *N, Out << ")"; } -static void writeMDFile(raw_ostream &Out, const MDFile *N, TypePrinting *, +static void writeDIFile(raw_ostream &Out, const DIFile *N, TypePrinting *, SlotTracker *, const Module *) { - Out << "!MDFile("; + Out << "!DIFile("; MDFieldPrinter Printer(Out); Printer.printString("filename", N->getFilename(), /* ShouldSkipEmpty */ false); @@ -1602,10 +1602,10 @@ static void writeMDFile(raw_ostream &Out, const MDFile *N, TypePrinting *, Out << ")"; } -static void writeMDCompileUnit(raw_ostream &Out, const MDCompileUnit *N, +static void writeDICompileUnit(raw_ostream &Out, const DICompileUnit *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDCompileUnit("; + Out << "!DICompileUnit("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printDwarfEnum("language", N->getSourceLanguage(), dwarf::LanguageString, /* ShouldSkipZero */ false); @@ -1626,10 +1626,10 @@ static void writeMDCompileUnit(raw_ostream &Out, const MDCompileUnit *N, Out << ")"; } -static void writeMDSubprogram(raw_ostream &Out, const MDSubprogram *N, +static void writeDISubprogram(raw_ostream &Out, const DISubprogram *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDSubprogram("; + Out << "!DISubprogram("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printString("name", N->getName()); Printer.printString("linkageName", N->getLinkageName()); @@ -1653,10 +1653,10 @@ static void writeMDSubprogram(raw_ostream &Out, const MDSubprogram *N, Out << ")"; } -static void writeMDLexicalBlock(raw_ostream &Out, const MDLexicalBlock *N, - TypePrinting *TypePrinter, SlotTracker *Machine, - const Module *Context) { - Out << "!MDLexicalBlock("; +static void writeDILexicalBlock(raw_ostream &Out, const DILexicalBlock *N, + TypePrinting *TypePrinter, SlotTracker *Machine, + const Module *Context) { + Out << "!DILexicalBlock("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false); Printer.printMetadata("file", N->getRawFile()); @@ -1665,12 +1665,12 @@ static void writeMDLexicalBlock(raw_ostream &Out, const MDLexicalBlock *N, Out << ")"; } -static void writeMDLexicalBlockFile(raw_ostream &Out, - const MDLexicalBlockFile *N, +static void writeDILexicalBlockFile(raw_ostream &Out, + const DILexicalBlockFile *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDLexicalBlockFile("; + Out << "!DILexicalBlockFile("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false); Printer.printMetadata("file", N->getRawFile()); @@ -1679,10 +1679,10 @@ static void writeMDLexicalBlockFile(raw_ostream &Out, Out << ")"; } -static void writeMDNamespace(raw_ostream &Out, const MDNamespace *N, +static void writeDINamespace(raw_ostream &Out, const DINamespace *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDNamespace("; + Out << "!DINamespace("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printString("name", N->getName()); Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false); @@ -1691,24 +1691,24 @@ static void writeMDNamespace(raw_ostream &Out, const MDNamespace *N, Out << ")"; } -static void writeMDTemplateTypeParameter(raw_ostream &Out, - const MDTemplateTypeParameter *N, +static void writeDITemplateTypeParameter(raw_ostream &Out, + const DITemplateTypeParameter *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDTemplateTypeParameter("; + Out << "!DITemplateTypeParameter("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printString("name", N->getName()); Printer.printMetadata("type", N->getRawType(), /* ShouldSkipNull */ false); Out << ")"; } -static void writeMDTemplateValueParameter(raw_ostream &Out, - const MDTemplateValueParameter *N, +static void writeDITemplateValueParameter(raw_ostream &Out, + const DITemplateValueParameter *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDTemplateValueParameter("; + Out << "!DITemplateValueParameter("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); if (N->getTag() != dwarf::DW_TAG_template_value_parameter) Printer.printTag(N); @@ -1718,10 +1718,10 @@ static void writeMDTemplateValueParameter(raw_ostream &Out, Out << ")"; } -static void writeMDGlobalVariable(raw_ostream &Out, const MDGlobalVariable *N, +static void writeDIGlobalVariable(raw_ostream &Out, const DIGlobalVariable *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDGlobalVariable("; + Out << "!DIGlobalVariable("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printString("name", N->getName()); Printer.printString("linkageName", N->getLinkageName()); @@ -1736,10 +1736,10 @@ static void writeMDGlobalVariable(raw_ostream &Out, const MDGlobalVariable *N, Out << ")"; } -static void writeMDLocalVariable(raw_ostream &Out, const MDLocalVariable *N, +static void writeDILocalVariable(raw_ostream &Out, const DILocalVariable *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDLocalVariable("; + Out << "!DILocalVariable("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printTag(N); Printer.printString("name", N->getName()); @@ -1754,10 +1754,10 @@ static void writeMDLocalVariable(raw_ostream &Out, const MDLocalVariable *N, Out << ")"; } -static void writeMDExpression(raw_ostream &Out, const MDExpression *N, +static void writeDIExpression(raw_ostream &Out, const DIExpression *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDExpression("; + Out << "!DIExpression("; FieldSeparator FS; if (N->isValid()) { for (auto I = N->expr_op_begin(), E = N->expr_op_end(); I != E; ++I) { @@ -1775,10 +1775,10 @@ static void writeMDExpression(raw_ostream &Out, const MDExpression *N, Out << ")"; } -static void writeMDObjCProperty(raw_ostream &Out, const MDObjCProperty *N, +static void writeDIObjCProperty(raw_ostream &Out, const DIObjCProperty *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDObjCProperty("; + Out << "!DIObjCProperty("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printString("name", N->getName()); Printer.printMetadata("file", N->getRawFile()); @@ -1790,10 +1790,10 @@ static void writeMDObjCProperty(raw_ostream &Out, const MDObjCProperty *N, Out << ")"; } -static void writeMDImportedEntity(raw_ostream &Out, const MDImportedEntity *N, +static void writeDIImportedEntity(raw_ostream &Out, const DIImportedEntity *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { - Out << "!MDImportedEntity("; + Out << "!DIImportedEntity("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); Printer.printTag(N); Printer.printString("name", N->getName()); diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index c849f1030bc..3baa4680905 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -87,13 +87,13 @@ void DIBuilder::finalize() { RetainValues.push_back(AllRetainTypes[I]); TempRetainTypes->replaceAllUsesWith(MDTuple::get(VMContext, RetainValues)); - MDSubprogramArray SPs = MDTuple::get(VMContext, AllSubprograms); + DISubprogramArray SPs = MDTuple::get(VMContext, AllSubprograms); TempSubprograms->replaceAllUsesWith(SPs.get()); for (auto *SP : SPs) { if (MDTuple *Temp = SP->getVariables().get()) { const auto &PV = PreservedVariables.lookup(SP); SmallVector<Metadata *, 4> Variables(PV.begin(), PV.end()); - DebugNodeArray AV = getOrCreateArray(Variables); + DINodeArray AV = getOrCreateArray(Variables); TempMDTuple(Temp)->replaceAllUsesWith(AV.get()); } } @@ -116,13 +116,13 @@ void DIBuilder::finalize() { } /// If N is compile unit return NULL otherwise return N. -static MDScope *getNonCompileUnitScope(MDScope *N) { - if (!N || isa<MDCompileUnit>(N)) +static DIScope *getNonCompileUnitScope(DIScope *N) { + if (!N || isa<DICompileUnit>(N)) return nullptr; - return cast<MDScope>(N); + return cast<DIScope>(N); } -MDCompileUnit *DIBuilder::createCompileUnit( +DICompileUnit *DIBuilder::createCompileUnit( unsigned Lang, StringRef Filename, StringRef Directory, StringRef Producer, bool isOptimized, StringRef Flags, unsigned RunTimeVer, StringRef SplitName, DebugEmissionKind Kind, bool EmitDebugInfo) { @@ -133,7 +133,7 @@ MDCompileUnit *DIBuilder::createCompileUnit( assert(!Filename.empty() && "Unable to create compile unit without filename"); - // TODO: Once we make MDCompileUnit distinct, stop using temporaries here + // TODO: Once we make DICompileUnit distinct, stop using temporaries here // (just start with operands assigned to nullptr). TempEnumTypes = MDTuple::getTemporary(VMContext, None); TempRetainTypes = MDTuple::getTemporary(VMContext, None); @@ -143,8 +143,8 @@ MDCompileUnit *DIBuilder::createCompileUnit( // TODO: Switch to getDistinct(). We never want to merge compile units based // on contents. - MDCompileUnit *CUNode = MDCompileUnit::get( - VMContext, Lang, MDFile::get(VMContext, Filename, Directory), Producer, + DICompileUnit *CUNode = DICompileUnit::get( + VMContext, Lang, DIFile::get(VMContext, Filename, Directory), Producer, isOptimized, Flags, RunTimeVer, SplitName, Kind, TempEnumTypes.get(), TempRetainTypes.get(), TempSubprograms.get(), TempGVs.get(), TempImportedModules.get()); @@ -163,132 +163,132 @@ MDCompileUnit *DIBuilder::createCompileUnit( return CUNode; } -static MDImportedEntity* -createImportedModule(LLVMContext &C, dwarf::Tag Tag, MDScope* Context, +static DIImportedEntity * +createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context, Metadata *NS, unsigned Line, StringRef Name, SmallVectorImpl<TrackingMDNodeRef> &AllImportedModules) { - auto *M = - MDImportedEntity::get(C, Tag, Context, DebugNodeRef(NS), Line, Name); + auto *M = DIImportedEntity::get(C, Tag, Context, DINodeRef(NS), Line, Name); AllImportedModules.emplace_back(M); return M; } -MDImportedEntity* DIBuilder::createImportedModule(MDScope* Context, - MDNamespace* NS, - unsigned Line) { +DIImportedEntity *DIBuilder::createImportedModule(DIScope *Context, + DINamespace *NS, + unsigned Line) { return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module, Context, NS, Line, StringRef(), AllImportedModules); } -MDImportedEntity* DIBuilder::createImportedModule(MDScope* Context, - MDImportedEntity* NS, - unsigned Line) { +DIImportedEntity *DIBuilder::createImportedModule(DIScope *Context, + DIImportedEntity *NS, + unsigned Line) { return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module, Context, NS, Line, StringRef(), AllImportedModules); } -MDImportedEntity *DIBuilder::createImportedDeclaration(MDScope *Context, - DebugNode *Decl, +DIImportedEntity *DIBuilder::createImportedDeclaration(DIScope *Context, + DINode *Decl, unsigned Line, StringRef Name) { // Make sure to use the unique identifier based metadata reference for // types that have one. return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_declaration, - Context, DebugNodeRef::get(Decl), Line, Name, + Context, DINodeRef::get(Decl), Line, Name, AllImportedModules); } -MDFile* DIBuilder::createFile(StringRef Filename, StringRef Directory) { - return MDFile::get(VMContext, Filename, Directory); +DIFile *DIBuilder::createFile(StringRef Filename, StringRef Directory) { + return DIFile::get(VMContext, Filename, Directory); } -MDEnumerator *DIBuilder::createEnumerator(StringRef Name, int64_t Val) { +DIEnumerator *DIBuilder::createEnumerator(StringRef Name, int64_t Val) { assert(!Name.empty() && "Unable to create enumerator without name"); - return MDEnumerator::get(VMContext, Val, Name); + return DIEnumerator::get(VMContext, Val, Name); } -MDBasicType *DIBuilder::createUnspecifiedType(StringRef Name) { +DIBasicType *DIBuilder::createUnspecifiedType(StringRef Name) { assert(!Name.empty() && "Unable to create type without name"); - return MDBasicType::get(VMContext, dwarf::DW_TAG_unspecified_type, Name); + return DIBasicType::get(VMContext, dwarf::DW_TAG_unspecified_type, Name); } -MDBasicType *DIBuilder::createNullPtrType() { +DIBasicType *DIBuilder::createNullPtrType() { return createUnspecifiedType("decltype(nullptr)"); } -MDBasicType *DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits, +DIBasicType *DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Encoding) { assert(!Name.empty() && "Unable to create type without name"); - return MDBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits, + return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits, AlignInBits, Encoding); } -MDDerivedType *DIBuilder::createQualifiedType(unsigned Tag, MDType *FromTy) { - return MDDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, - MDTypeRef::get(FromTy), 0, 0, 0, 0); +DIDerivedType *DIBuilder::createQualifiedType(unsigned Tag, DIType *FromTy) { + return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, + DITypeRef::get(FromTy), 0, 0, 0, 0); } -MDDerivedType *DIBuilder::createPointerType(MDType *PointeeTy, +DIDerivedType *DIBuilder::createPointerType(DIType *PointeeTy, uint64_t SizeInBits, uint64_t AlignInBits, StringRef Name) { // FIXME: Why is there a name here? - return MDDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name, - nullptr, 0, nullptr, MDTypeRef::get(PointeeTy), + return DIDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name, + nullptr, 0, nullptr, DITypeRef::get(PointeeTy), SizeInBits, AlignInBits, 0, 0); } -MDDerivedType *DIBuilder::createMemberPointerType(MDType *PointeeTy, - MDType *Base, +DIDerivedType *DIBuilder::createMemberPointerType(DIType *PointeeTy, + DIType *Base, uint64_t SizeInBits, uint64_t AlignInBits) { - return MDDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "", - nullptr, 0, nullptr, MDTypeRef::get(PointeeTy), - SizeInBits, AlignInBits, 0, 0, MDTypeRef::get(Base)); + return DIDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "", + nullptr, 0, nullptr, DITypeRef::get(PointeeTy), + SizeInBits, AlignInBits, 0, 0, + DITypeRef::get(Base)); } -MDDerivedType *DIBuilder::createReferenceType(unsigned Tag, MDType *RTy) { +DIDerivedType *DIBuilder::createReferenceType(unsigned Tag, DIType *RTy) { assert(RTy && "Unable to create reference type"); - return MDDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, - MDTypeRef::get(RTy), 0, 0, 0, 0); + return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, + DITypeRef::get(RTy), 0, 0, 0, 0); } -MDDerivedType *DIBuilder::createTypedef(MDType *Ty, StringRef Name, - MDFile *File, unsigned LineNo, - MDScope *Context) { - return MDDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File, +DIDerivedType *DIBuilder::createTypedef(DIType *Ty, StringRef Name, + DIFile *File, unsigned LineNo, + DIScope *Context) { + return DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File, LineNo, - MDScopeRef::get(getNonCompileUnitScope(Context)), - MDTypeRef::get(Ty), 0, 0, 0, 0); + DIScopeRef::get(getNonCompileUnitScope(Context)), + DITypeRef::get(Ty), 0, 0, 0, 0); } -MDDerivedType *DIBuilder::createFriend(MDType *Ty, MDType *FriendTy) { +DIDerivedType *DIBuilder::createFriend(DIType *Ty, DIType *FriendTy) { assert(Ty && "Invalid type!"); assert(FriendTy && "Invalid friend type!"); - return MDDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0, - MDTypeRef::get(Ty), MDTypeRef::get(FriendTy), 0, 0, + return DIDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0, + DITypeRef::get(Ty), DITypeRef::get(FriendTy), 0, 0, 0, 0); } -MDDerivedType *DIBuilder::createInheritance(MDType *Ty, MDType *BaseTy, +DIDerivedType *DIBuilder::createInheritance(DIType *Ty, DIType *BaseTy, uint64_t BaseOffset, unsigned Flags) { assert(Ty && "Unable to create inheritance"); - return MDDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr, - 0, MDTypeRef::get(Ty), MDTypeRef::get(BaseTy), 0, 0, + return DIDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr, + 0, DITypeRef::get(Ty), DITypeRef::get(BaseTy), 0, 0, BaseOffset, Flags); } -MDDerivedType *DIBuilder::createMemberType(MDScope *Scope, StringRef Name, - MDFile *File, unsigned LineNumber, +DIDerivedType *DIBuilder::createMemberType(DIScope *Scope, StringRef Name, + DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, - unsigned Flags, MDType *Ty) { - return MDDerivedType::get( + unsigned Flags, DIType *Ty) { + return DIDerivedType::get( VMContext, dwarf::DW_TAG_member, Name, File, LineNumber, - MDScopeRef::get(getNonCompileUnitScope(Scope)), MDTypeRef::get(Ty), + DIScopeRef::get(getNonCompileUnitScope(Scope)), DITypeRef::get(Ty), SizeInBits, AlignInBits, OffsetInBits, Flags); } @@ -298,91 +298,91 @@ static ConstantAsMetadata *getConstantOrNull(Constant *C) { return nullptr; } -MDDerivedType *DIBuilder::createStaticMemberType(MDScope *Scope, StringRef Name, - MDFile *File, +DIDerivedType *DIBuilder::createStaticMemberType(DIScope *Scope, StringRef Name, + DIFile *File, unsigned LineNumber, - MDType *Ty, unsigned Flags, + DIType *Ty, unsigned Flags, llvm::Constant *Val) { - Flags |= DebugNode::FlagStaticMember; - return MDDerivedType::get( + Flags |= DINode::FlagStaticMember; + return DIDerivedType::get( VMContext, dwarf::DW_TAG_member, Name, File, LineNumber, - MDScopeRef::get(getNonCompileUnitScope(Scope)), MDTypeRef::get(Ty), 0, 0, + DIScopeRef::get(getNonCompileUnitScope(Scope)), DITypeRef::get(Ty), 0, 0, 0, Flags, getConstantOrNull(Val)); } -MDDerivedType *DIBuilder::createObjCIVar(StringRef Name, MDFile *File, +DIDerivedType *DIBuilder::createObjCIVar(StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, - MDType *Ty, MDNode *PropertyNode) { - return MDDerivedType::get( + DIType *Ty, MDNode *PropertyNode) { + return DIDerivedType::get( VMContext, dwarf::DW_TAG_member, Name, File, LineNumber, - MDScopeRef::get(getNonCompileUnitScope(File)), MDTypeRef::get(Ty), + DIScopeRef::get(getNonCompileUnitScope(File)), DITypeRef::get(Ty), SizeInBits, AlignInBits, OffsetInBits, Flags, PropertyNode); } -MDObjCProperty * -DIBuilder::createObjCProperty(StringRef Name, MDFile *File, unsigned LineNumber, +DIObjCProperty * +DIBuilder::createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber, StringRef GetterName, StringRef SetterName, - unsigned PropertyAttributes, MDType *Ty) { - return MDObjCProperty::get(VMContext, Name, File, LineNumber, GetterName, + unsigned PropertyAttributes, DIType *Ty) { + return DIObjCProperty::get(VMContext, Name, File, LineNumber, GetterName, SetterName, PropertyAttributes, Ty); } -MDTemplateTypeParameter * -DIBuilder::createTemplateTypeParameter(MDScope *Context, StringRef Name, - MDType *Ty) { - assert((!Context || isa<MDCompileUnit>(Context)) && "Expected compile unit"); - return MDTemplateTypeParameter::get(VMContext, Name, MDTypeRef::get(Ty)); +DITemplateTypeParameter * +DIBuilder::createTemplateTypeParameter(DIScope *Context, StringRef Name, + DIType *Ty) { + assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit"); + return DITemplateTypeParameter::get(VMContext, Name, DITypeRef::get(Ty)); } -static MDTemplateValueParameter * +static DITemplateValueParameter * createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag, - MDScope *Context, StringRef Name, MDType *Ty, + DIScope *Context, StringRef Name, DIType *Ty, Metadata *MD) { - assert((!Context || isa<MDCompileUnit>(Context)) && "Expected compile unit"); - return MDTemplateValueParameter::get(VMContext, Tag, Name, MDTypeRef::get(Ty), + assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit"); + return DITemplateValueParameter::get(VMContext, Tag, Name, DITypeRef::get(Ty), MD); } -MDTemplateValueParameter * -DIBuilder::createTemplateValueParameter(MDScope *Context, StringRef Name, - MDType *Ty, Constant *Val) { +DITemplateValueParameter * +DIBuilder::createTemplateValueParameter(DIScope *Context, StringRef Name, + DIType *Ty, Constant *Val) { return createTemplateValueParameterHelper( VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty, getConstantOrNull(Val)); } -MDTemplateValueParameter * -DIBuilder::createTemplateTemplateParameter(MDScope *Context, StringRef Name, - MDType *Ty, StringRef Val) { +DITemplateValueParameter * +DIBuilder::createTemplateTemplateParameter(DIScope *Context, StringRef Name, + DIType *Ty, StringRef Val) { return createTemplateValueParameterHelper( VMContext, dwarf::DW_TAG_GNU_template_template_param, Context, Name, Ty, MDString::get(VMContext, Val)); } -MDTemplateValueParameter * -DIBuilder::createTemplateParameterPack(MDScope *Context, StringRef Name, - MDType *Ty, DebugNodeArray Val) { +DITemplateValueParameter * +DIBuilder::createTemplateParameterPack(DIScope *Context, StringRef Name, + DIType *Ty, DINodeArray Val) { return createTemplateValueParameterHelper( VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty, Val.get()); } -MDCompositeType *DIBuilder::createClassType( - MDScope *Context, StringRef Name, MDFile *File, unsigned LineNumber, +DICompositeType *DIBuilder::createClassType( + DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, - unsigned Flags, MDType *DerivedFrom, DebugNodeArray Elements, - MDType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) { - assert((!Context || isa<MDScope>(Context)) && + unsigned Flags, DIType *DerivedFrom, DINodeArray Elements, + DIType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) { + assert((!Context || isa<DIScope>(Context)) && "createClassType should be called with a valid Context"); - auto *R = MDCompositeType::get( + auto *R = DICompositeType::get( VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber, - MDScopeRef::get(getNonCompileUnitScope(Context)), - MDTypeRef::get(DerivedFrom), SizeInBits, AlignInBits, OffsetInBits, Flags, - Elements, 0, MDTypeRef::get(VTableHolder), + DIScopeRef::get(getNonCompileUnitScope(Context)), + DITypeRef::get(DerivedFrom), SizeInBits, AlignInBits, OffsetInBits, Flags, + Elements, 0, DITypeRef::get(VTableHolder), cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier); if (!UniqueIdentifier.empty()) retainType(R); @@ -390,29 +390,29 @@ MDCompositeType *DIBuilder::createClassType( return R; } -MDCompositeType *DIBuilder::createStructType( - MDScope *Context, StringRef Name, MDFile *File, unsigned LineNumber, +DICompositeType *DIBuilder::createStructType( + DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags, - MDType *DerivedFrom, DebugNodeArray Elements, unsigned RunTimeLang, - MDType *VTableHolder, StringRef UniqueIdentifier) { - auto *R = MDCompositeType::get( + DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang, + DIType *VTableHolder, StringRef UniqueIdentifier) { + auto *R = DICompositeType::get( VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber, - MDScopeRef::get(getNonCompileUnitScope(Context)), - MDTypeRef::get(DerivedFrom), SizeInBits, AlignInBits, 0, Flags, Elements, - RunTimeLang, MDTypeRef::get(VTableHolder), nullptr, UniqueIdentifier); + DIScopeRef::get(getNonCompileUnitScope(Context)), + DITypeRef::get(DerivedFrom), SizeInBits, AlignInBits, 0, Flags, Elements, + RunTimeLang, DITypeRef::get(VTableHolder), nullptr, UniqueIdentifier); if (!UniqueIdentifier.empty()) retainType(R); trackIfUnresolved(R); return R; } -MDCompositeType *DIBuilder::createUnionType( - MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber, +DICompositeType *DIBuilder::createUnionType( + DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags, - DebugNodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) { - auto *R = MDCompositeType::get( + DINodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) { + auto *R = DICompositeType::get( VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber, - MDScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits, + DIScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits, AlignInBits, 0, Flags, Elements, RunTimeLang, nullptr, nullptr, UniqueIdentifier); if (!UniqueIdentifier.empty()) @@ -421,20 +421,20 @@ MDCompositeType *DIBuilder::createUnionType( return R; } -MDSubroutineType *DIBuilder::createSubroutineType(MDFile *File, - MDTypeRefArray ParameterTypes, +DISubroutineType *DIBuilder::createSubroutineType(DIFile *File, + DITypeRefArray ParameterTypes, unsigned Flags) { - return MDSubroutineType::get(VMContext, Flags, ParameterTypes); + return DISubroutineType::get(VMContext, Flags, ParameterTypes); } -MDCompositeType *DIBuilder::createEnumerationType( - MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, DebugNodeArray Elements, - MDType *UnderlyingType, StringRef UniqueIdentifier) { - auto *CTy = MDCompositeType::get( +DICompositeType *DIBuilder::createEnumerationType( + DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, + uint64_t SizeInBits, uint64_t AlignInBits, DINodeArray Elements, + DIType *UnderlyingType, StringRef UniqueIdentifier) { + auto *CTy = DICompositeType::get( VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber, - MDScopeRef::get(getNonCompileUnitScope(Scope)), - MDTypeRef::get(UnderlyingType), SizeInBits, AlignInBits, 0, 0, Elements, + DIScopeRef::get(getNonCompileUnitScope(Scope)), + DITypeRef::get(UnderlyingType), SizeInBits, AlignInBits, 0, 0, Elements, 0, nullptr, nullptr, UniqueIdentifier); AllEnumTypes.push_back(CTy); if (!UniqueIdentifier.empty()) @@ -443,67 +443,67 @@ MDCompositeType *DIBuilder::createEnumerationType( return CTy; } -MDCompositeType *DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits, - MDType *Ty, - DebugNodeArray Subscripts) { - auto *R = MDCompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", - nullptr, 0, nullptr, MDTypeRef::get(Ty), Size, +DICompositeType *DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits, + DIType *Ty, + DINodeArray Subscripts) { + auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", + nullptr, 0, nullptr, DITypeRef::get(Ty), Size, AlignInBits, 0, 0, Subscripts, 0, nullptr); trackIfUnresolved(R); return R; } -MDCompositeType *DIBuilder::createVectorType(uint64_t Size, - uint64_t AlignInBits, MDType *Ty, - DebugNodeArray Subscripts) { +DICompositeType *DIBuilder::createVectorType(uint64_t Size, + uint64_t AlignInBits, DIType *Ty, + DINodeArray Subscripts) { auto *R = - MDCompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0, - nullptr, MDTypeRef::get(Ty), Size, AlignInBits, 0, - DebugNode::FlagVector, Subscripts, 0, nullptr); + DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0, + nullptr, DITypeRef::get(Ty), Size, AlignInBits, 0, + DINode::FlagVector, Subscripts, 0, nullptr); trackIfUnresolved(R); return R; } -static MDType *createTypeWithFlags(LLVMContext &Context, MDType *Ty, +static DIType *createTypeWithFlags(LLVMContext &Context, DIType *Ty, unsigned FlagsToSet) { auto NewTy = Ty->clone(); NewTy->setFlags(NewTy->getFlags() | FlagsToSet); return MDNode::replaceWithUniqued(std::move(NewTy)); } -MDType *DIBuilder::createArtificialType(MDType *Ty) { +DIType *DIBuilder::createArtificialType(DIType *Ty) { // FIXME: Restrict this to the nodes where it's valid. if (Ty->isArtificial()) return Ty; - return createTypeWithFlags(VMContext, Ty, DebugNode::FlagArtificial); + return createTypeWithFlags(VMContext, Ty, DINode::FlagArtificial); } -MDType *DIBuilder::createObjectPointerType(MDType *Ty) { +DIType *DIBuilder::createObjectPointerType(DIType *Ty) { // FIXME: Restrict this to the nodes where it's valid. if (Ty->isObjectPointer()) return Ty; - unsigned Flags = DebugNode::FlagObjectPointer | DebugNode::FlagArtificial; + unsigned Flags = DINode::FlagObjectPointer | DINode::FlagArtificial; return createTypeWithFlags(VMContext, Ty, Flags); } -void DIBuilder::retainType(MDType *T) { +void DIBuilder::retainType(DIType *T) { assert(T && "Expected non-null type"); AllRetainTypes.emplace_back(T); } -MDBasicType *DIBuilder::createUnspecifiedParameter() { return nullptr; } +DIBasicType *DIBuilder::createUnspecifiedParameter() { return nullptr; } -MDCompositeType* -DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, MDScope * Scope, - MDFile* F, unsigned Line, unsigned RuntimeLang, +DICompositeType * +DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope, + DIFile *F, unsigned Line, unsigned RuntimeLang, uint64_t SizeInBits, uint64_t AlignInBits, StringRef UniqueIdentifier) { // FIXME: Define in terms of createReplaceableForwardDecl() by calling // replaceWithUniqued(). - auto *RetTy = MDCompositeType::get( + auto *RetTy = DICompositeType::get( VMContext, Tag, Name, F, Line, - MDScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits, - AlignInBits, 0, DebugNode::FlagFwdDecl, nullptr, RuntimeLang, nullptr, + DIScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits, + AlignInBits, 0, DINode::FlagFwdDecl, nullptr, RuntimeLang, nullptr, nullptr, UniqueIdentifier); if (!UniqueIdentifier.empty()) retainType(RetTy); @@ -511,118 +511,119 @@ DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, MDScope * Scope, return RetTy; } -MDCompositeType* DIBuilder::createReplaceableCompositeType( - unsigned Tag, StringRef Name, MDScope * Scope, MDFile* F, unsigned Line, +DICompositeType *DIBuilder::createReplaceableCompositeType( + unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags, StringRef UniqueIdentifier) { - auto *RetTy = MDCompositeType::getTemporary( + auto *RetTy = DICompositeType::getTemporary( VMContext, Tag, Name, F, Line, - MDScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, + DIScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits, AlignInBits, 0, Flags, nullptr, RuntimeLang, - nullptr, nullptr, UniqueIdentifier).release(); + nullptr, nullptr, UniqueIdentifier) + .release(); if (!UniqueIdentifier.empty()) retainType(RetTy); trackIfUnresolved(RetTy); return RetTy; } -DebugNodeArray DIBuilder::getOrCreateArray(ArrayRef<Metadata *> Elements) { +DINodeArray DIBuilder::getOrCreateArray(ArrayRef<Metadata *> Elements) { return MDTuple::get(VMContext, Elements); } -MDTypeRefArray DIBuilder::getOrCreateTypeArray(ArrayRef<Metadata *> Elements) { +DITypeRefArray DIBuilder::getOrCreateTypeArray(ArrayRef<Metadata *> Elements) { SmallVector<llvm::Metadata *, 16> Elts; for (unsigned i = 0, e = Elements.size(); i != e; ++i) { if (Elements[i] && isa<MDNode>(Elements[i])) - Elts.push_back(MDTypeRef::get(cast<MDType>(Elements[i]))); + Elts.push_back(DITypeRef::get(cast<DIType>(Elements[i]))); else Elts.push_back(Elements[i]); } - return MDTypeRefArray(MDNode::get(VMContext, Elts)); + return DITypeRefArray(MDNode::get(VMContext, Elts)); } -MDSubrange *DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) { - return MDSubrange::get(VMContext, Count, Lo); +DISubrange *DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) { + return DISubrange::get(VMContext, Count, Lo); } -static void checkGlobalVariableScope(MDScope * Context) { +static void checkGlobalVariableScope(DIScope *Context) { #ifndef NDEBUG if (auto *CT = - dyn_cast_or_null<MDCompositeType>(getNonCompileUnitScope(Context))) + dyn_cast_or_null<DICompositeType>(getNonCompileUnitScope(Context))) assert(CT->getIdentifier().empty() && "Context of a global variable should not be a type with identifier"); #endif } -MDGlobalVariable *DIBuilder::createGlobalVariable( - MDScope *Context, StringRef Name, StringRef LinkageName, MDFile *F, - unsigned LineNumber, MDType *Ty, bool isLocalToUnit, Constant *Val, +DIGlobalVariable *DIBuilder::createGlobalVariable( + DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F, + unsigned LineNumber, DIType *Ty, bool isLocalToUnit, Constant *Val, MDNode *Decl) { checkGlobalVariableScope(Context); - auto *N = MDGlobalVariable::get(VMContext, cast_or_null<MDScope>(Context), + auto *N = DIGlobalVariable::get(VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F, LineNumber, - MDTypeRef::get(Ty), isLocalToUnit, true, Val, - cast_or_null<MDDerivedType>(Decl)); + DITypeRef::get(Ty), isLocalToUnit, true, Val, + cast_or_null<DIDerivedType>(Decl)); AllGVs.push_back(N); return N; } -MDGlobalVariable *DIBuilder::createTempGlobalVariableFwdDecl( - MDScope *Context, StringRef Name, StringRef LinkageName, MDFile *F, - unsigned LineNumber, MDType *Ty, bool isLocalToUnit, Constant *Val, +DIGlobalVariable *DIBuilder::createTempGlobalVariableFwdDecl( + DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F, + unsigned LineNumber, DIType *Ty, bool isLocalToUnit, Constant *Val, MDNode *Decl) { checkGlobalVariableScope(Context); - return MDGlobalVariable::getTemporary( - VMContext, cast_or_null<MDScope>(Context), Name, LinkageName, F, - LineNumber, MDTypeRef::get(Ty), isLocalToUnit, false, Val, - cast_or_null<MDDerivedType>(Decl)) + return DIGlobalVariable::getTemporary( + VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F, + LineNumber, DITypeRef::get(Ty), isLocalToUnit, false, Val, + cast_or_null<DIDerivedType>(Decl)) .release(); } -MDLocalVariable *DIBuilder::createLocalVariable( - unsigned Tag, MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNo, - MDType *Ty, bool AlwaysPreserve, unsigned Flags, unsigned ArgNo) { +DILocalVariable *DIBuilder::createLocalVariable( + unsigned Tag, DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, + DIType *Ty, bool AlwaysPreserve, unsigned Flags, unsigned ArgNo) { // FIXME: Why getNonCompileUnitScope()? // FIXME: Why is "!Context" okay here? // FIXME: WHy doesn't this check for a subprogram or lexical block (AFAICT // the only valid scopes)? - MDScope* Context = getNonCompileUnitScope(Scope); + DIScope *Context = getNonCompileUnitScope(Scope); - auto *Node = MDLocalVariable::get( - VMContext, Tag, cast_or_null<MDLocalScope>(Context), Name, File, LineNo, - MDTypeRef::get(Ty), ArgNo, Flags); + auto *Node = DILocalVariable::get( + VMContext, Tag, cast_or_null<DILocalScope>(Context), Name, File, LineNo, + DITypeRef::get(Ty), ArgNo, Flags); if (AlwaysPreserve) { // The optimizer may remove local variable. If there is an interest // to preserve variable info in such situation then stash it in a // named mdnode. - MDSubprogram *Fn = getDISubprogram(Scope); + DISubprogram *Fn = getDISubprogram(Scope); assert(Fn && "Missing subprogram for local variable"); PreservedVariables[Fn].emplace_back(Node); } return Node; } -MDExpression* DIBuilder::createExpression(ArrayRef<uint64_t> Addr) { - return MDExpression::get(VMContext, Addr); +DIExpression *DIBuilder::createExpression(ArrayRef<uint64_t> Addr) { + return DIExpression::get(VMContext, Addr); } -MDExpression* DIBuilder::createExpression(ArrayRef<int64_t> Signed) { +DIExpression *DIBuilder::createExpression(ArrayRef<int64_t> Signed) { // TODO: Remove the callers of this signed version and delete. SmallVector<uint64_t, 8> Addr(Signed.begin(), Signed.end()); return createExpression(Addr); } -MDExpression* DIBuilder::createBitPieceExpression(unsigned OffsetInBytes, - unsigned SizeInBytes) { +DIExpression *DIBuilder::createBitPieceExpression(unsigned OffsetInBytes, + unsigned SizeInBytes) { uint64_t Addr[] = {dwarf::DW_OP_bit_piece, OffsetInBytes, SizeInBytes}; - return MDExpression::get(VMContext, Addr); + return DIExpression::get(VMContext, Addr); } -MDSubprogram *DIBuilder::createFunction(MDScopeRef Context, StringRef Name, - StringRef LinkageName, MDFile *File, - unsigned LineNo, MDSubroutineType *Ty, +DISubprogram *DIBuilder::createFunction(DIScopeRef Context, StringRef Name, + StringRef LinkageName, DIFile *File, + unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit, bool isDefinition, unsigned ScopeLine, unsigned Flags, bool isOptimized, Function *Fn, @@ -635,20 +636,20 @@ MDSubprogram *DIBuilder::createFunction(MDScopeRef Context, StringRef Name, Flags, isOptimized, Fn, TParams, Decl); } -MDSubprogram* DIBuilder::createFunction(MDScope * Context, StringRef Name, - StringRef LinkageName, MDFile* File, - unsigned LineNo, MDSubroutineType* Ty, - bool isLocalToUnit, bool isDefinition, - unsigned ScopeLine, unsigned Flags, - bool isOptimized, Function *Fn, - MDNode *TParams, MDNode *Decl) { +DISubprogram *DIBuilder::createFunction(DIScope *Context, StringRef Name, + StringRef LinkageName, DIFile *File, + unsigned LineNo, DISubroutineType *Ty, + bool isLocalToUnit, bool isDefinition, + unsigned ScopeLine, unsigned Flags, + bool isOptimized, Function *Fn, + MDNode *TParams, MDNode *Decl) { assert(Ty->getTag() == dwarf::DW_TAG_subroutine_type && "function types should be subroutines"); - auto *Node = MDSubprogram::get( - VMContext, MDScopeRef::get(getNonCompileUnitScope(Context)), Name, - LinkageName, File, LineNo, Ty, - isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized, - Fn, cast_or_null<MDTuple>(TParams), cast_or_null<MDSubprogram>(Decl), + auto *Node = DISubprogram::get( + VMContext, DIScopeRef::get(getNonCompileUnitScope(Context)), Name, + LinkageName, File, LineNo, Ty, isLocalToUnit, isDefinition, ScopeLine, + nullptr, 0, 0, Flags, isOptimized, Fn, cast_or_null<MDTuple>(TParams), + cast_or_null<DISubprogram>(Decl), MDTuple::getTemporary(VMContext, None).release()); if (isDefinition) @@ -657,27 +658,25 @@ MDSubprogram* DIBuilder::createFunction(MDScope * Context, StringRef Name, return Node; } -MDSubprogram* -DIBuilder::createTempFunctionFwdDecl(MDScope * Context, StringRef Name, - StringRef LinkageName, MDFile* File, - unsigned LineNo, MDSubroutineType* Ty, - bool isLocalToUnit, bool isDefinition, - unsigned ScopeLine, unsigned Flags, - bool isOptimized, Function *Fn, - MDNode *TParams, MDNode *Decl) { - return MDSubprogram::getTemporary( - VMContext, MDScopeRef::get(getNonCompileUnitScope(Context)), Name, - LinkageName, File, LineNo, Ty, - isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, Flags, - isOptimized, Fn, cast_or_null<MDTuple>(TParams), - cast_or_null<MDSubprogram>(Decl), nullptr).release(); -} - -MDSubprogram * -DIBuilder::createMethod(MDScope *Context, StringRef Name, StringRef LinkageName, - MDFile *F, unsigned LineNo, MDSubroutineType *Ty, +DISubprogram *DIBuilder::createTempFunctionFwdDecl( + DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, + unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit, + bool isDefinition, unsigned ScopeLine, unsigned Flags, bool isOptimized, + Function *Fn, MDNode *TParams, MDNode *Decl) { + return DISubprogram::getTemporary( + VMContext, DIScopeRef::get(getNonCompileUnitScope(Context)), Name, + LinkageName, File, LineNo, Ty, isLocalToUnit, isDefinition, + ScopeLine, nullptr, 0, 0, Flags, isOptimized, Fn, + cast_or_null<MDTuple>(TParams), cast_or_null<DISubprogram>(Decl), + nullptr) + .release(); +} + +DISubprogram * +DIBuilder::createMethod(DIScope *Context, StringRef Name, StringRef LinkageName, + DIFile *F, unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit, bool isDefinition, unsigned VK, - unsigned VIndex, MDType *VTableHolder, unsigned Flags, + unsigned VIndex, DIType *VTableHolder, unsigned Flags, bool isOptimized, Function *Fn, MDNode *TParam) { assert(Ty->getTag() == dwarf::DW_TAG_subroutine_type && "function types should be subroutines"); @@ -685,10 +684,10 @@ DIBuilder::createMethod(MDScope *Context, StringRef Name, StringRef LinkageName, "Methods should have both a Context and a context that isn't " "the compile unit."); // FIXME: Do we want to use different scope/lines? - auto *SP = MDSubprogram::get( - VMContext, MDScopeRef::get(cast<MDScope>(Context)), Name, LinkageName, F, + auto *SP = DISubprogram::get( + VMContext, DIScopeRef::get(cast<DIScope>(Context)), Name, LinkageName, F, LineNo, Ty, isLocalToUnit, isDefinition, LineNo, - MDTypeRef::get(VTableHolder), VK, VIndex, Flags, isOptimized, Fn, + DITypeRef::get(VTableHolder), VK, VIndex, Flags, isOptimized, Fn, cast_or_null<MDTuple>(TParam), nullptr, nullptr); if (isDefinition) @@ -697,23 +696,23 @@ DIBuilder::createMethod(MDScope *Context, StringRef Name, StringRef LinkageName, return SP; } -MDNamespace* DIBuilder::createNameSpace(MDScope * Scope, StringRef Name, - MDFile* File, unsigned LineNo) { - return MDNamespace::get(VMContext, getNonCompileUnitScope(Scope), File, Name, +DINamespace *DIBuilder::createNameSpace(DIScope *Scope, StringRef Name, + DIFile *File, unsigned LineNo) { + return DINamespace::get(VMContext, getNonCompileUnitScope(Scope), File, Name, LineNo); } -MDLexicalBlockFile* DIBuilder::createLexicalBlockFile(MDScope * Scope, - MDFile* File, - unsigned Discriminator) { - return MDLexicalBlockFile::get(VMContext, Scope, File, Discriminator); +DILexicalBlockFile *DIBuilder::createLexicalBlockFile(DIScope *Scope, + DIFile *File, + unsigned Discriminator) { + return DILexicalBlockFile::get(VMContext, Scope, File, Discriminator); } -MDLexicalBlock* DIBuilder::createLexicalBlock(MDScope * Scope, MDFile* File, - unsigned Line, unsigned Col) { +DILexicalBlock *DIBuilder::createLexicalBlock(DIScope *Scope, DIFile *File, + unsigned Line, unsigned Col) { // Make these distinct, to avoid merging two lexical blocks on the same // file/line/column. - return MDLexicalBlock::getDistinct(VMContext, getNonCompileUnitScope(Scope), + return DILexicalBlock::getDistinct(VMContext, getNonCompileUnitScope(Scope), File, Line, Col); } @@ -722,15 +721,15 @@ static Value *getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V) { return MetadataAsValue::get(VMContext, ValueAsMetadata::get(V)); } -static Instruction *withDebugLoc(Instruction *I, const MDLocation *DL) { - I->setDebugLoc(const_cast<MDLocation *>(DL)); +static Instruction *withDebugLoc(Instruction *I, const DILocation *DL) { + I->setDebugLoc(const_cast<DILocation *>(DL)); return I; } -Instruction *DIBuilder::insertDeclare(Value *Storage, MDLocalVariable* VarInfo, - MDExpression* Expr, const MDLocation *DL, +Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo, + DIExpression *Expr, const DILocation *DL, Instruction *InsertBefore) { - assert(VarInfo && "empty or invalid MDLocalVariable* passed to dbg.declare"); + assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.declare"); assert(DL && "Expected debug loc"); assert(DL->getScope()->getSubprogram() == VarInfo->getScope()->getSubprogram() && @@ -746,10 +745,10 @@ Instruction *DIBuilder::insertDeclare(Value *Storage, MDLocalVariable* VarInfo, return withDebugLoc(CallInst::Create(DeclareFn, Args, "", InsertBefore), DL); } -Instruction *DIBuilder::insertDeclare(Value *Storage, MDLocalVariable* VarInfo, - MDExpression* Expr, const MDLocation *DL, +Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo, + DIExpression *Expr, const DILocation *DL, BasicBlock *InsertAtEnd) { - assert(VarInfo && "empty or invalid MDLocalVariable* passed to dbg.declare"); + assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.declare"); assert(DL && "Expected debug loc"); assert(DL->getScope()->getSubprogram() == VarInfo->getScope()->getSubprogram() && @@ -771,12 +770,12 @@ Instruction *DIBuilder::insertDeclare(Value *Storage, MDLocalVariable* VarInfo, } Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset, - MDLocalVariable* VarInfo, - MDExpression* Expr, - const MDLocation *DL, + DILocalVariable *VarInfo, + DIExpression *Expr, + const DILocation *DL, Instruction *InsertBefore) { assert(V && "no value passed to dbg.value"); - assert(VarInfo && "empty or invalid MDLocalVariable* passed to dbg.value"); + assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.value"); assert(DL && "Expected debug loc"); assert(DL->getScope()->getSubprogram() == VarInfo->getScope()->getSubprogram() && @@ -794,12 +793,12 @@ Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset, } Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset, - MDLocalVariable* VarInfo, - MDExpression* Expr, - const MDLocation *DL, + DILocalVariable *VarInfo, + DIExpression *Expr, + const DILocation *DL, BasicBlock *InsertAtEnd) { assert(V && "no value passed to dbg.value"); - assert(VarInfo && "empty or invalid MDLocalVariable* passed to dbg.value"); + assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.value"); assert(DL && "Expected debug loc"); assert(DL->getScope()->getSubprogram() == VarInfo->getScope()->getSubprogram() && @@ -817,10 +816,11 @@ Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset, return withDebugLoc(CallInst::Create(ValueFn, Args, "", InsertAtEnd), DL); } -void DIBuilder::replaceVTableHolder(MDCompositeType* &T, MDCompositeType* VTableHolder) { +void DIBuilder::replaceVTableHolder(DICompositeType *&T, + DICompositeType *VTableHolder) { { - TypedTrackingMDRef<MDCompositeType> N(T); - N->replaceVTableHolder(MDTypeRef::get(VTableHolder)); + TypedTrackingMDRef<DICompositeType> N(T); + N->replaceVTableHolder(DITypeRef::get(VTableHolder)); T = N.get(); } @@ -836,14 +836,14 @@ void DIBuilder::replaceVTableHolder(MDCompositeType* &T, MDCompositeType* VTable trackIfUnresolved(N); } -void DIBuilder::replaceArrays(MDCompositeType *&T, DebugNodeArray Elements, - DebugNodeArray TParams) { +void DIBuilder::replaceArrays(DICompositeType *&T, DINodeArray Elements, + DINodeArray TParams) { { - TypedTrackingMDRef<MDCompositeType> N(T); + TypedTrackingMDRef<DICompositeType> N(T); if (Elements) N->replaceElements(Elements); if (TParams) - N->replaceTemplateParams(MDTemplateParameterArray(TParams)); + N->replaceTemplateParams(DITemplateParameterArray(TParams)); T = N.get(); } diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index ccc2c7c72e9..2e161c2ba6c 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -33,13 +33,13 @@ using namespace llvm; using namespace llvm::dwarf; -MDSubprogram *llvm::getDISubprogram(const MDNode *Scope) { - if (auto *LocalScope = dyn_cast_or_null<MDLocalScope>(Scope)) +DISubprogram *llvm::getDISubprogram(const MDNode *Scope) { + if (auto *LocalScope = dyn_cast_or_null<DILocalScope>(Scope)) return LocalScope->getSubprogram(); return nullptr; } -MDSubprogram *llvm::getDISubprogram(const Function *F) { +DISubprogram *llvm::getDISubprogram(const Function *F) { // We look for the first instr that has a debug annotation leading back to F. for (auto &BB : *F) { auto Inst = std::find_if(BB.begin(), BB.end(), [](const Instruction &Inst) { @@ -56,11 +56,11 @@ MDSubprogram *llvm::getDISubprogram(const Function *F) { return nullptr; } -MDCompositeTypeBase *llvm::getDICompositeType(MDType *T) { - if (auto *C = dyn_cast_or_null<MDCompositeTypeBase>(T)) +DICompositeTypeBase *llvm::getDICompositeType(DIType *T) { + if (auto *C = dyn_cast_or_null<DICompositeTypeBase>(T)) return C; - if (auto *D = dyn_cast_or_null<MDDerivedTypeBase>(T)) { + if (auto *D = dyn_cast_or_null<DIDerivedTypeBase>(T)) { // This function is currently used by dragonegg and dragonegg does // not generate identifier for types, so using an empty map to resolve // DerivedFrom should be fine. @@ -75,12 +75,12 @@ DITypeIdentifierMap llvm::generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes) { DITypeIdentifierMap Map; for (unsigned CUi = 0, CUe = CU_Nodes->getNumOperands(); CUi != CUe; ++CUi) { - auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(CUi)); - DebugNodeArray Retain = CU->getRetainedTypes(); + auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(CUi)); + DINodeArray Retain = CU->getRetainedTypes(); for (unsigned Ti = 0, Te = Retain.size(); Ti != Te; ++Ti) { - if (!isa<MDCompositeType>(Retain[Ti])) + if (!isa<DICompositeType>(Retain[Ti])) continue; - auto *Ty = cast<MDCompositeType>(Retain[Ti]); + auto *Ty = cast<DICompositeType>(Retain[Ti]); if (MDString *TypeId = Ty->getRawIdentifier()) { // Definition has priority over declaration. // Try to insert (TypeId, Ty) to Map. @@ -123,7 +123,7 @@ void DebugInfoFinder::processModule(const Module &M) { InitializeTypeMap(M); if (NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu")) { for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) { - auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(i)); + auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i)); addCompileUnit(CU); for (auto *DIG : CU->getGlobalVariables()) { if (addGlobalVariable(DIG)) { @@ -139,18 +139,18 @@ void DebugInfoFinder::processModule(const Module &M) { processType(RT); for (auto *Import : CU->getImportedEntities()) { auto *Entity = Import->getEntity().resolve(TypeIdentifierMap); - if (auto *T = dyn_cast<MDType>(Entity)) + if (auto *T = dyn_cast<DIType>(Entity)) processType(T); - else if (auto *SP = dyn_cast<MDSubprogram>(Entity)) + else if (auto *SP = dyn_cast<DISubprogram>(Entity)) processSubprogram(SP); - else if (auto *NS = dyn_cast<MDNamespace>(Entity)) + else if (auto *NS = dyn_cast<DINamespace>(Entity)) processScope(NS->getScope()); } } } } -void DebugInfoFinder::processLocation(const Module &M, const MDLocation *Loc) { +void DebugInfoFinder::processLocation(const Module &M, const DILocation *Loc) { if (!Loc) return; InitializeTypeMap(M); @@ -158,61 +158,61 @@ void DebugInfoFinder::processLocation(const Module &M, const MDLocation *Loc) { processLocation(M, Loc->getInlinedAt()); } -void DebugInfoFinder::processType(MDType *DT) { +void DebugInfoFinder::processType(DIType *DT) { if (!addType(DT)) return; processScope(DT->getScope().resolve(TypeIdentifierMap)); - if (auto *DCT = dyn_cast<MDCompositeTypeBase>(DT)) { + if (auto *DCT = dyn_cast<DICompositeTypeBase>(DT)) { processType(DCT->getBaseType().resolve(TypeIdentifierMap)); - if (auto *ST = dyn_cast<MDSubroutineType>(DCT)) { - for (MDTypeRef Ref : ST->getTypeArray()) + if (auto *ST = dyn_cast<DISubroutineType>(DCT)) { + for (DITypeRef Ref : ST->getTypeArray()) processType(Ref.resolve(TypeIdentifierMap)); return; } for (Metadata *D : DCT->getElements()) { - if (auto *T = dyn_cast<MDType>(D)) + if (auto *T = dyn_cast<DIType>(D)) processType(T); - else if (auto *SP = dyn_cast<MDSubprogram>(D)) + else if (auto *SP = dyn_cast<DISubprogram>(D)) processSubprogram(SP); } - } else if (auto *DDT = dyn_cast<MDDerivedTypeBase>(DT)) { + } else if (auto *DDT = dyn_cast<DIDerivedTypeBase>(DT)) { processType(DDT->getBaseType().resolve(TypeIdentifierMap)); } } -void DebugInfoFinder::processScope(MDScope *Scope) { +void DebugInfoFinder::processScope(DIScope *Scope) { if (!Scope) return; - if (auto *Ty = dyn_cast<MDType>(Scope)) { + if (auto *Ty = dyn_cast<DIType>(Scope)) { processType(Ty); return; } - if (auto *CU = dyn_cast<MDCompileUnit>(Scope)) { + if (auto *CU = dyn_cast<DICompileUnit>(Scope)) { addCompileUnit(CU); return; } - if (auto *SP = dyn_cast<MDSubprogram>(Scope)) { + if (auto *SP = dyn_cast<DISubprogram>(Scope)) { processSubprogram(SP); return; } if (!addScope(Scope)) return; - if (auto *LB = dyn_cast<MDLexicalBlockBase>(Scope)) { + if (auto *LB = dyn_cast<DILexicalBlockBase>(Scope)) { processScope(LB->getScope()); - } else if (auto *NS = dyn_cast<MDNamespace>(Scope)) { + } else if (auto *NS = dyn_cast<DINamespace>(Scope)) { processScope(NS->getScope()); } } -void DebugInfoFinder::processSubprogram(MDSubprogram *SP) { +void DebugInfoFinder::processSubprogram(DISubprogram *SP) { if (!addSubprogram(SP)) return; processScope(SP->getScope().resolve(TypeIdentifierMap)); processType(SP->getType()); for (auto *Element : SP->getTemplateParams()) { - if (auto *TType = dyn_cast<MDTemplateTypeParameter>(Element)) { + if (auto *TType = dyn_cast<DITemplateTypeParameter>(Element)) { processType(TType->getType().resolve(TypeIdentifierMap)); - } else if (auto *TVal = dyn_cast<MDTemplateValueParameter>(Element)) { + } else if (auto *TVal = dyn_cast<DITemplateValueParameter>(Element)) { processType(TVal->getType().resolve(TypeIdentifierMap)); } } @@ -225,7 +225,7 @@ void DebugInfoFinder::processDeclare(const Module &M, return; InitializeTypeMap(M); - auto *DV = dyn_cast<MDLocalVariable>(N); + auto *DV = dyn_cast<DILocalVariable>(N); if (!DV) return; @@ -241,7 +241,7 @@ void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) { return; InitializeTypeMap(M); - auto *DV = dyn_cast<MDLocalVariable>(N); + auto *DV = dyn_cast<DILocalVariable>(N); if (!DV) return; @@ -251,18 +251,18 @@ void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) { processType(DV->getType().resolve(TypeIdentifierMap)); } -bool DebugInfoFinder::addType(MDType *DT) { +bool DebugInfoFinder::addType(DIType *DT) { if (!DT) return false; if (!NodesSeen.insert(DT).second) return false; - TYs.push_back(const_cast<MDType *>(DT)); + TYs.push_back(const_cast<DIType *>(DT)); return true; } -bool DebugInfoFinder::addCompileUnit(MDCompileUnit *CU) { +bool DebugInfoFinder::addCompileUnit(DICompileUnit *CU) { if (!CU) return false; if (!NodesSeen.insert(CU).second) @@ -272,7 +272,7 @@ bool DebugInfoFinder::addCompileUnit(MDCompileUnit *CU) { return true; } -bool DebugInfoFinder::addGlobalVariable(MDGlobalVariable *DIG) { +bool DebugInfoFinder::addGlobalVariable(DIGlobalVariable *DIG) { if (!DIG) return false; @@ -283,7 +283,7 @@ bool DebugInfoFinder::addGlobalVariable(MDGlobalVariable *DIG) { return true; } -bool DebugInfoFinder::addSubprogram(MDSubprogram *SP) { +bool DebugInfoFinder::addSubprogram(DISubprogram *SP) { if (!SP) return false; @@ -294,7 +294,7 @@ bool DebugInfoFinder::addSubprogram(MDSubprogram *SP) { return true; } -bool DebugInfoFinder::addScope(MDScope *Scope) { +bool DebugInfoFinder::addScope(DIScope *Scope) { if (!Scope) return false; // FIXME: Ocaml binding generates a scope with no content, we treat it @@ -369,16 +369,16 @@ unsigned llvm::getDebugMetadataVersionFromModule(const Module &M) { return 0; } -DenseMap<const llvm::Function *, MDSubprogram *> +DenseMap<const llvm::Function *, DISubprogram *> llvm::makeSubprogramMap(const Module &M) { - DenseMap<const Function *, MDSubprogram *> R; + DenseMap<const Function *, DISubprogram *> R; NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu"); if (!CU_Nodes) return R; for (MDNode *N : CU_Nodes->operands()) { - auto *CUNode = cast<MDCompileUnit>(N); + auto *CUNode = cast<DICompileUnit>(N); for (auto *SP : CUNode->getSubprograms()) { if (Function *F = SP->getFunction()) R.insert(std::make_pair(F, SP)); diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index 4be35636cf8..85335d547b1 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -19,9 +19,9 @@ using namespace llvm; -MDLocation::MDLocation(LLVMContext &C, StorageType Storage, unsigned Line, +DILocation::DILocation(LLVMContext &C, StorageType Storage, unsigned Line, unsigned Column, ArrayRef<Metadata *> MDs) - : MDNode(C, MDLocationKind, Storage, MDs) { + : MDNode(C, DILocationKind, Storage, MDs) { assert((MDs.size() == 1 || MDs.size() == 2) && "Expected a scope and optional inlined-at"); @@ -38,7 +38,7 @@ static void adjustColumn(unsigned &Column) { Column = 0; } -MDLocation *MDLocation::getImpl(LLVMContext &Context, unsigned Line, +DILocation *DILocation::getImpl(LLVMContext &Context, unsigned Line, unsigned Column, Metadata *Scope, Metadata *InlinedAt, StorageType Storage, bool ShouldCreate) { @@ -48,8 +48,8 @@ MDLocation *MDLocation::getImpl(LLVMContext &Context, unsigned Line, assert(Scope && "Expected scope"); if (Storage == Uniqued) { if (auto *N = - getUniqued(Context.pImpl->MDLocations, - MDLocationInfo::KeyTy(Line, Column, Scope, InlinedAt))) + getUniqued(Context.pImpl->DILocations, + DILocationInfo::KeyTy(Line, Column, Scope, InlinedAt))) return N; if (!ShouldCreate) return nullptr; @@ -62,11 +62,11 @@ MDLocation *MDLocation::getImpl(LLVMContext &Context, unsigned Line, if (InlinedAt) Ops.push_back(InlinedAt); return storeImpl(new (Ops.size()) - MDLocation(Context, Storage, Line, Column, Ops), - Storage, Context.pImpl->MDLocations); + DILocation(Context, Storage, Line, Column, Ops), + Storage, Context.pImpl->DILocations); } -unsigned MDLocation::computeNewDiscriminator() const { +unsigned DILocation::computeNewDiscriminator() const { // FIXME: This seems completely wrong. // // 1. If two modules are generated in the same context, then the second @@ -83,14 +83,14 @@ unsigned MDLocation::computeNewDiscriminator() const { return ++getContext().pImpl->DiscriminatorTable[Key]; } -unsigned DebugNode::getFlag(StringRef Flag) { +unsigned DINode::getFlag(StringRef Flag) { return StringSwitch<unsigned>(Flag) #define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME) #include "llvm/IR/DebugInfoFlags.def" .Default(0); } -const char *DebugNode::getFlagString(unsigned Flag) { +const char *DINode::getFlagString(unsigned Flag) { switch (Flag) { default: return ""; @@ -101,8 +101,8 @@ const char *DebugNode::getFlagString(unsigned Flag) { } } -unsigned DebugNode::splitFlags(unsigned Flags, - SmallVectorImpl<unsigned> &SplitFlags) { +unsigned DINode::splitFlags(unsigned Flags, + SmallVectorImpl<unsigned> &SplitFlags) { // Accessibility flags need to be specially handled, since they're packed // together. if (unsigned A = Flags & FlagAccessibility) { @@ -125,33 +125,33 @@ unsigned DebugNode::splitFlags(unsigned Flags, return Flags; } -MDScopeRef MDScope::getScope() const { - if (auto *T = dyn_cast<MDType>(this)) +DIScopeRef DIScope::getScope() const { + if (auto *T = dyn_cast<DIType>(this)) return T->getScope(); - if (auto *SP = dyn_cast<MDSubprogram>(this)) + if (auto *SP = dyn_cast<DISubprogram>(this)) return SP->getScope(); - if (auto *LB = dyn_cast<MDLexicalBlockBase>(this)) - return MDScopeRef(LB->getScope()); + if (auto *LB = dyn_cast<DILexicalBlockBase>(this)) + return DIScopeRef(LB->getScope()); - if (auto *NS = dyn_cast<MDNamespace>(this)) - return MDScopeRef(NS->getScope()); + if (auto *NS = dyn_cast<DINamespace>(this)) + return DIScopeRef(NS->getScope()); - assert((isa<MDFile>(this) || isa<MDCompileUnit>(this)) && + assert((isa<DIFile>(this) || isa<DICompileUnit>(this)) && "Unhandled type of scope."); return nullptr; } -StringRef MDScope::getName() const { - if (auto *T = dyn_cast<MDType>(this)) +StringRef DIScope::getName() const { + if (auto *T = dyn_cast<DIType>(this)) return T->getName(); - if (auto *SP = dyn_cast<MDSubprogram>(this)) + if (auto *SP = dyn_cast<DISubprogram>(this)) return SP->getName(); - if (auto *NS = dyn_cast<MDNamespace>(this)) + if (auto *NS = dyn_cast<DINamespace>(this)) return NS->getName(); - assert((isa<MDLexicalBlockBase>(this) || isa<MDFile>(this) || - isa<MDCompileUnit>(this)) && + assert((isa<DILexicalBlockBase>(this) || isa<DIFile>(this) || + isa<DICompileUnit>(this)) && "Unhandled type of scope."); return ""; } @@ -168,15 +168,14 @@ static bool isCanonical(const MDString *S) { } #endif -GenericDebugNode *GenericDebugNode::getImpl(LLVMContext &Context, unsigned Tag, - MDString *Header, - ArrayRef<Metadata *> DwarfOps, - StorageType Storage, - bool ShouldCreate) { +GenericDINode *GenericDINode::getImpl(LLVMContext &Context, unsigned Tag, + MDString *Header, + ArrayRef<Metadata *> DwarfOps, + StorageType Storage, bool ShouldCreate) { unsigned Hash = 0; if (Storage == Uniqued) { - GenericDebugNodeInfo::KeyTy Key(Tag, getString(Header), DwarfOps); - if (auto *N = getUniqued(Context.pImpl->GenericDebugNodes, Key)) + GenericDINodeInfo::KeyTy Key(Tag, getString(Header), DwarfOps); + if (auto *N = getUniqued(Context.pImpl->GenericDINodes, Key)) return N; if (!ShouldCreate) return nullptr; @@ -188,13 +187,13 @@ GenericDebugNode *GenericDebugNode::getImpl(LLVMContext &Context, unsigned Tag, // Use a nullptr for empty headers. assert(isCanonical(Header) && "Expected canonical MDString"); Metadata *PreOps[] = {Header}; - return storeImpl(new (DwarfOps.size() + 1) GenericDebugNode( + return storeImpl(new (DwarfOps.size() + 1) GenericDINode( Context, Storage, Hash, Tag, PreOps, DwarfOps), - Storage, Context.pImpl->GenericDebugNodes); + Storage, Context.pImpl->GenericDINodes); } -void GenericDebugNode::recalculateHash() { - setHash(GenericDebugNodeInfo::KeyTy::calculateHash(this)); +void GenericDINode::recalculateHash() { + setHash(GenericDINodeInfo::KeyTy::calculateHash(this)); } #define UNWRAP_ARGS_IMPL(...) __VA_ARGS__ @@ -224,49 +223,49 @@ void GenericDebugNode::recalculateHash() { CLASS(Context, Storage, OPS), \ Storage, Context.pImpl->CLASS##s) -MDSubrange *MDSubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo, +DISubrange *DISubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo, StorageType Storage, bool ShouldCreate) { - DEFINE_GETIMPL_LOOKUP(MDSubrange, (Count, Lo)); - DEFINE_GETIMPL_STORE_NO_OPS(MDSubrange, (Count, Lo)); + DEFINE_GETIMPL_LOOKUP(DISubrange, (Count, Lo)); + DEFINE_GETIMPL_STORE_NO_OPS(DISubrange, (Count, Lo)); } -MDEnumerator *MDEnumerator::getImpl(LLVMContext &Context, int64_t Value, +DIEnumerator *DIEnumerator::getImpl(LLVMContext &Context, int64_t Value, MDString *Name, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP(MDEnumerator, (Value, getString(Name))); + DEFINE_GETIMPL_LOOKUP(DIEnumerator, (Value, getString(Name))); Metadata *Ops[] = {Name}; - DEFINE_GETIMPL_STORE(MDEnumerator, (Value), Ops); + DEFINE_GETIMPL_STORE(DIEnumerator, (Value), Ops); } -MDBasicType *MDBasicType::getImpl(LLVMContext &Context, unsigned Tag, +DIBasicType *DIBasicType::getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Encoding, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); DEFINE_GETIMPL_LOOKUP( - MDBasicType, (Tag, getString(Name), SizeInBits, AlignInBits, Encoding)); + DIBasicType, (Tag, getString(Name), SizeInBits, AlignInBits, Encoding)); Metadata *Ops[] = {nullptr, nullptr, Name}; - DEFINE_GETIMPL_STORE(MDBasicType, (Tag, SizeInBits, AlignInBits, Encoding), + DEFINE_GETIMPL_STORE(DIBasicType, (Tag, SizeInBits, AlignInBits, Encoding), Ops); } -MDDerivedType *MDDerivedType::getImpl( +DIDerivedType *DIDerivedType::getImpl( LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, Metadata *ExtraData, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP(MDDerivedType, (Tag, getString(Name), File, Line, Scope, + DEFINE_GETIMPL_LOOKUP(DIDerivedType, (Tag, getString(Name), File, Line, Scope, BaseType, SizeInBits, AlignInBits, OffsetInBits, Flags, ExtraData)); Metadata *Ops[] = {File, Scope, Name, BaseType, ExtraData}; DEFINE_GETIMPL_STORE( - MDDerivedType, (Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags), + DIDerivedType, (Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags), Ops); } -MDCompositeType *MDCompositeType::getImpl( +DICompositeType *DICompositeType::getImpl( LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, @@ -274,39 +273,39 @@ MDCompositeType *MDCompositeType::getImpl( Metadata *TemplateParams, MDString *Identifier, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP(MDCompositeType, + DEFINE_GETIMPL_LOOKUP(DICompositeType, (Tag, getString(Name), File, Line, Scope, BaseType, SizeInBits, AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang, VTableHolder, TemplateParams, getString(Identifier))); Metadata *Ops[] = {File, Scope, Name, BaseType, Elements, VTableHolder, TemplateParams, Identifier}; - DEFINE_GETIMPL_STORE(MDCompositeType, (Tag, Line, RuntimeLang, SizeInBits, + DEFINE_GETIMPL_STORE(DICompositeType, (Tag, Line, RuntimeLang, SizeInBits, AlignInBits, OffsetInBits, Flags), Ops); } -MDSubroutineType *MDSubroutineType::getImpl(LLVMContext &Context, +DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context, unsigned Flags, Metadata *TypeArray, StorageType Storage, bool ShouldCreate) { - DEFINE_GETIMPL_LOOKUP(MDSubroutineType, (Flags, TypeArray)); + DEFINE_GETIMPL_LOOKUP(DISubroutineType, (Flags, TypeArray)); Metadata *Ops[] = {nullptr, nullptr, nullptr, nullptr, TypeArray, nullptr, nullptr, nullptr}; - DEFINE_GETIMPL_STORE(MDSubroutineType, (Flags), Ops); + DEFINE_GETIMPL_STORE(DISubroutineType, (Flags), Ops); } -MDFile *MDFile::getImpl(LLVMContext &Context, MDString *Filename, +DIFile *DIFile::getImpl(LLVMContext &Context, MDString *Filename, MDString *Directory, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Filename) && "Expected canonical MDString"); assert(isCanonical(Directory) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP(MDFile, (getString(Filename), getString(Directory))); + DEFINE_GETIMPL_LOOKUP(DIFile, (getString(Filename), getString(Directory))); Metadata *Ops[] = {Filename, Directory}; - DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDFile, Ops); + DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DIFile, Ops); } -MDCompileUnit *MDCompileUnit::getImpl( +DICompileUnit *DICompileUnit::getImpl( LLVMContext &Context, unsigned SourceLanguage, Metadata *File, MDString *Producer, bool IsOptimized, MDString *Flags, unsigned RuntimeVersion, MDString *SplitDebugFilename, @@ -317,7 +316,7 @@ MDCompileUnit *MDCompileUnit::getImpl( assert(isCanonical(Flags) && "Expected canonical MDString"); assert(isCanonical(SplitDebugFilename) && "Expected canonical MDString"); DEFINE_GETIMPL_LOOKUP( - MDCompileUnit, + DICompileUnit, (SourceLanguage, File, getString(Producer), IsOptimized, getString(Flags), RuntimeVersion, getString(SplitDebugFilename), EmissionKind, EnumTypes, RetainedTypes, Subprograms, GlobalVariables, ImportedEntities)); @@ -325,17 +324,17 @@ MDCompileUnit *MDCompileUnit::getImpl( RetainedTypes, Subprograms, GlobalVariables, ImportedEntities}; DEFINE_GETIMPL_STORE( - MDCompileUnit, + DICompileUnit, (SourceLanguage, IsOptimized, RuntimeVersion, EmissionKind), Ops); } -MDSubprogram *MDLocalScope::getSubprogram() const { - if (auto *Block = dyn_cast<MDLexicalBlockBase>(this)) +DISubprogram *DILocalScope::getSubprogram() const { + if (auto *Block = dyn_cast<DILexicalBlockBase>(this)) return Block->getScope()->getSubprogram(); - return const_cast<MDSubprogram *>(cast<MDSubprogram>(this)); + return const_cast<DISubprogram *>(cast<DISubprogram>(this)); } -MDSubprogram *MDSubprogram::getImpl( +DISubprogram *DISubprogram::getImpl( LLVMContext &Context, Metadata *Scope, MDString *Name, MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine, @@ -345,7 +344,7 @@ MDSubprogram *MDSubprogram::getImpl( StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); assert(isCanonical(LinkageName) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP(MDSubprogram, + DEFINE_GETIMPL_LOOKUP(DISubprogram, (Scope, getString(Name), getString(LinkageName), File, Line, Type, IsLocalToUnit, IsDefinition, ScopeLine, ContainingType, Virtuality, VirtualIndex, Flags, @@ -354,18 +353,18 @@ MDSubprogram *MDSubprogram::getImpl( Metadata *Ops[] = {File, Scope, Name, Name, LinkageName, Type, ContainingType, Function, TemplateParams, Declaration, Variables}; - DEFINE_GETIMPL_STORE(MDSubprogram, + DEFINE_GETIMPL_STORE(DISubprogram, (Line, ScopeLine, Virtuality, VirtualIndex, Flags, IsLocalToUnit, IsDefinition, IsOptimized), Ops); } -Function *MDSubprogram::getFunction() const { +Function *DISubprogram::getFunction() const { // FIXME: Should this be looking through bitcasts? return dyn_cast_or_null<Function>(getFunctionConstant()); } -bool MDSubprogram::describes(const Function *F) const { +bool DISubprogram::describes(const Function *F) const { assert(F && "Invalid function"); if (F == getFunction()) return true; @@ -375,64 +374,64 @@ bool MDSubprogram::describes(const Function *F) const { return F->getName() == Name; } -void MDSubprogram::replaceFunction(Function *F) { +void DISubprogram::replaceFunction(Function *F) { replaceFunction(F ? ConstantAsMetadata::get(F) : static_cast<ConstantAsMetadata *>(nullptr)); } -MDLexicalBlock *MDLexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope, +DILexicalBlock *DILexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope, Metadata *File, unsigned Line, unsigned Column, StorageType Storage, bool ShouldCreate) { assert(Scope && "Expected scope"); - DEFINE_GETIMPL_LOOKUP(MDLexicalBlock, (Scope, File, Line, Column)); + DEFINE_GETIMPL_LOOKUP(DILexicalBlock, (Scope, File, Line, Column)); Metadata *Ops[] = {File, Scope}; - DEFINE_GETIMPL_STORE(MDLexicalBlock, (Line, Column), Ops); + DEFINE_GETIMPL_STORE(DILexicalBlock, (Line, Column), Ops); } -MDLexicalBlockFile *MDLexicalBlockFile::getImpl(LLVMContext &Context, +DILexicalBlockFile *DILexicalBlockFile::getImpl(LLVMContext &Context, Metadata *Scope, Metadata *File, unsigned Discriminator, StorageType Storage, bool ShouldCreate) { assert(Scope && "Expected scope"); - DEFINE_GETIMPL_LOOKUP(MDLexicalBlockFile, (Scope, File, Discriminator)); + DEFINE_GETIMPL_LOOKUP(DILexicalBlockFile, (Scope, File, Discriminator)); Metadata *Ops[] = {File, Scope}; - DEFINE_GETIMPL_STORE(MDLexicalBlockFile, (Discriminator), Ops); + DEFINE_GETIMPL_STORE(DILexicalBlockFile, (Discriminator), Ops); } -MDNamespace *MDNamespace::getImpl(LLVMContext &Context, Metadata *Scope, +DINamespace *DINamespace::getImpl(LLVMContext &Context, Metadata *Scope, Metadata *File, MDString *Name, unsigned Line, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP(MDNamespace, (Scope, File, getString(Name), Line)); + DEFINE_GETIMPL_LOOKUP(DINamespace, (Scope, File, getString(Name), Line)); Metadata *Ops[] = {File, Scope, Name}; - DEFINE_GETIMPL_STORE(MDNamespace, (Line), Ops); + DEFINE_GETIMPL_STORE(DINamespace, (Line), Ops); } -MDTemplateTypeParameter *MDTemplateTypeParameter::getImpl(LLVMContext &Context, +DITemplateTypeParameter *DITemplateTypeParameter::getImpl(LLVMContext &Context, MDString *Name, Metadata *Type, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP(MDTemplateTypeParameter, (getString(Name), Type)); + DEFINE_GETIMPL_LOOKUP(DITemplateTypeParameter, (getString(Name), Type)); Metadata *Ops[] = {Name, Type}; - DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDTemplateTypeParameter, Ops); + DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DITemplateTypeParameter, Ops); } -MDTemplateValueParameter *MDTemplateValueParameter::getImpl( +DITemplateValueParameter *DITemplateValueParameter::getImpl( LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type, Metadata *Value, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP(MDTemplateValueParameter, + DEFINE_GETIMPL_LOOKUP(DITemplateValueParameter, (Tag, getString(Name), Type, Value)); Metadata *Ops[] = {Name, Type, Value}; - DEFINE_GETIMPL_STORE(MDTemplateValueParameter, (Tag), Ops); + DEFINE_GETIMPL_STORE(DITemplateValueParameter, (Tag), Ops); } -MDGlobalVariable * -MDGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name, +DIGlobalVariable * +DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name, MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition, Metadata *Variable, @@ -440,17 +439,17 @@ MDGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); assert(isCanonical(LinkageName) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP(MDGlobalVariable, + DEFINE_GETIMPL_LOOKUP(DIGlobalVariable, (Scope, getString(Name), getString(LinkageName), File, Line, Type, IsLocalToUnit, IsDefinition, Variable, StaticDataMemberDeclaration)); Metadata *Ops[] = {Scope, Name, File, Type, Name, LinkageName, Variable, StaticDataMemberDeclaration}; - DEFINE_GETIMPL_STORE(MDGlobalVariable, (Line, IsLocalToUnit, IsDefinition), + DEFINE_GETIMPL_STORE(DIGlobalVariable, (Line, IsLocalToUnit, IsDefinition), Ops); } -MDLocalVariable *MDLocalVariable::getImpl(LLVMContext &Context, unsigned Tag, +DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, unsigned Tag, Metadata *Scope, MDString *Name, Metadata *File, unsigned Line, Metadata *Type, unsigned Arg, @@ -461,20 +460,20 @@ MDLocalVariable *MDLocalVariable::getImpl(LLVMContext &Context, unsigned Tag, assert(Scope && "Expected scope"); assert(isCanonical(Name) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP(MDLocalVariable, (Tag, Scope, getString(Name), File, + DEFINE_GETIMPL_LOOKUP(DILocalVariable, (Tag, Scope, getString(Name), File, Line, Type, Arg, Flags)); Metadata *Ops[] = {Scope, Name, File, Type}; - DEFINE_GETIMPL_STORE(MDLocalVariable, (Tag, Line, Arg, Flags), Ops); + DEFINE_GETIMPL_STORE(DILocalVariable, (Tag, Line, Arg, Flags), Ops); } -MDExpression *MDExpression::getImpl(LLVMContext &Context, +DIExpression *DIExpression::getImpl(LLVMContext &Context, ArrayRef<uint64_t> Elements, StorageType Storage, bool ShouldCreate) { - DEFINE_GETIMPL_LOOKUP(MDExpression, (Elements)); - DEFINE_GETIMPL_STORE_NO_OPS(MDExpression, (Elements)); + DEFINE_GETIMPL_LOOKUP(DIExpression, (Elements)); + DEFINE_GETIMPL_STORE_NO_OPS(DIExpression, (Elements)); } -unsigned MDExpression::ExprOperand::getSize() const { +unsigned DIExpression::ExprOperand::getSize() const { switch (getOp()) { case dwarf::DW_OP_bit_piece: return 3; @@ -485,7 +484,7 @@ unsigned MDExpression::ExprOperand::getSize() const { } } -bool MDExpression::isValid() const { +bool DIExpression::isValid() const { for (auto I = expr_op_begin(), E = expr_op_end(); I != E; ++I) { // Check that there's space for the operand. if (I->get() + I->getSize() > E->get()) @@ -506,7 +505,7 @@ bool MDExpression::isValid() const { return true; } -bool MDExpression::isBitPiece() const { +bool DIExpression::isBitPiece() const { assert(isValid() && "Expected valid expression"); if (unsigned N = getNumElements()) if (N >= 3) @@ -514,38 +513,38 @@ bool MDExpression::isBitPiece() const { return false; } -uint64_t MDExpression::getBitPieceOffset() const { +uint64_t DIExpression::getBitPieceOffset() const { assert(isBitPiece() && "Expected bit piece"); return getElement(getNumElements() - 2); } -uint64_t MDExpression::getBitPieceSize() const { +uint64_t DIExpression::getBitPieceSize() const { assert(isBitPiece() && "Expected bit piece"); return getElement(getNumElements() - 1); } -MDObjCProperty *MDObjCProperty::getImpl( +DIObjCProperty *DIObjCProperty::getImpl( LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line, MDString *GetterName, MDString *SetterName, unsigned Attributes, Metadata *Type, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); assert(isCanonical(GetterName) && "Expected canonical MDString"); assert(isCanonical(SetterName) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP(MDObjCProperty, + DEFINE_GETIMPL_LOOKUP(DIObjCProperty, (getString(Name), File, Line, getString(GetterName), getString(SetterName), Attributes, Type)); Metadata *Ops[] = {Name, File, GetterName, SetterName, Type}; - DEFINE_GETIMPL_STORE(MDObjCProperty, (Line, Attributes), Ops); + DEFINE_GETIMPL_STORE(DIObjCProperty, (Line, Attributes), Ops); } -MDImportedEntity *MDImportedEntity::getImpl(LLVMContext &Context, unsigned Tag, +DIImportedEntity *DIImportedEntity::getImpl(LLVMContext &Context, unsigned Tag, Metadata *Scope, Metadata *Entity, unsigned Line, MDString *Name, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP(MDImportedEntity, + DEFINE_GETIMPL_LOOKUP(DIImportedEntity, (Tag, Scope, Entity, Line, getString(Name))); Metadata *Ops[] = {Scope, Entity, Name}; - DEFINE_GETIMPL_STORE(MDImportedEntity, (Tag, Line), Ops); + DEFINE_GETIMPL_STORE(DIImportedEntity, (Tag, Line), Ops); } diff --git a/llvm/lib/IR/DebugLoc.cpp b/llvm/lib/IR/DebugLoc.cpp index 2d00c983311..72d5c0e6188 100644 --- a/llvm/lib/IR/DebugLoc.cpp +++ b/llvm/lib/IR/DebugLoc.cpp @@ -16,11 +16,11 @@ using namespace llvm; //===----------------------------------------------------------------------===// // DebugLoc Implementation //===----------------------------------------------------------------------===// -DebugLoc::DebugLoc(const MDLocation *L) : Loc(const_cast<MDLocation *>(L)) {} +DebugLoc::DebugLoc(const DILocation *L) : Loc(const_cast<DILocation *>(L)) {} DebugLoc::DebugLoc(const MDNode *L) : Loc(const_cast<MDNode *>(L)) {} -MDLocation *DebugLoc::get() const { - return cast_or_null<MDLocation>(Loc.get()); +DILocation *DebugLoc::get() const { + return cast_or_null<DILocation>(Loc.get()); } unsigned DebugLoc::getLine() const { @@ -38,17 +38,17 @@ MDNode *DebugLoc::getScope() const { return get()->getScope(); } -MDLocation *DebugLoc::getInlinedAt() const { +DILocation *DebugLoc::getInlinedAt() const { assert(get() && "Expected valid DebugLoc"); return get()->getInlinedAt(); } MDNode *DebugLoc::getInlinedAtScope() const { - return cast<MDLocation>(Loc)->getInlinedAtScope(); + return cast<DILocation>(Loc)->getInlinedAtScope(); } DebugLoc DebugLoc::getFnDebugLoc() const { - // FIXME: Add a method on \a MDLocation that does this work. + // FIXME: Add a method on \a DILocation that does this work. const MDNode *Scope = getInlinedAtScope(); if (auto *SP = getDISubprogram(Scope)) return DebugLoc::get(SP->getScopeLine(), 0, SP); @@ -62,7 +62,7 @@ DebugLoc DebugLoc::get(unsigned Line, unsigned Col, const MDNode *Scope, if (!Scope) return DebugLoc(); - return MDLocation::get(Scope->getContext(), Line, Col, + return DILocation::get(Scope->getContext(), Line, Col, const_cast<MDNode *>(Scope), const_cast<MDNode *>(InlinedAt)); } @@ -88,7 +88,7 @@ void DebugLoc::print(raw_ostream &OS) const { return; // Print source line info. - auto *Scope = cast<MDScope>(getScope()); + auto *Scope = cast<DIScope>(getScope()); OS << Scope->getFilename(); OS << ':' << getLine(); if (getCol() != 0) diff --git a/llvm/lib/IR/DiagnosticInfo.cpp b/llvm/lib/IR/DiagnosticInfo.cpp index 91635f67959..b161d07ac98 100644 --- a/llvm/lib/IR/DiagnosticInfo.cpp +++ b/llvm/lib/IR/DiagnosticInfo.cpp @@ -135,7 +135,7 @@ bool DiagnosticInfoOptimizationBase::isLocationAvailable() const { void DiagnosticInfoOptimizationBase::getLocation(StringRef *Filename, unsigned *Line, unsigned *Column) const { - MDLocation *L = getDebugLoc(); + DILocation *L = getDebugLoc(); *Filename = L->getFilename(); *Line = L->getLine(); *Column = L->getColumn(); diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index edffef31511..09c28838fe8 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -228,8 +228,8 @@ template <> struct MDNodeKeyImpl<MDTuple> : MDNodeOpsKey { } }; -/// \brief DenseMapInfo for MDLocation. -template <> struct MDNodeKeyImpl<MDLocation> { +/// \brief DenseMapInfo for DILocation. +template <> struct MDNodeKeyImpl<DILocation> { unsigned Line; unsigned Column; Metadata *Scope; @@ -239,11 +239,11 @@ template <> struct MDNodeKeyImpl<MDLocation> { Metadata *InlinedAt) : Line(Line), Column(Column), Scope(Scope), InlinedAt(InlinedAt) {} - MDNodeKeyImpl(const MDLocation *L) + MDNodeKeyImpl(const DILocation *L) : Line(L->getLine()), Column(L->getColumn()), Scope(L->getRawScope()), InlinedAt(L->getRawInlinedAt()) {} - bool isKeyOf(const MDLocation *RHS) const { + bool isKeyOf(const DILocation *RHS) const { return Line == RHS->getLine() && Column == RHS->getColumn() && Scope == RHS->getRawScope() && InlinedAt == RHS->getRawInlinedAt(); } @@ -252,57 +252,57 @@ template <> struct MDNodeKeyImpl<MDLocation> { } }; -/// \brief DenseMapInfo for GenericDebugNode. -template <> struct MDNodeKeyImpl<GenericDebugNode> : MDNodeOpsKey { +/// \brief DenseMapInfo for GenericDINode. +template <> struct MDNodeKeyImpl<GenericDINode> : MDNodeOpsKey { unsigned Tag; StringRef Header; MDNodeKeyImpl(unsigned Tag, StringRef Header, ArrayRef<Metadata *> DwarfOps) : MDNodeOpsKey(DwarfOps), Tag(Tag), Header(Header) {} - MDNodeKeyImpl(const GenericDebugNode *N) + MDNodeKeyImpl(const GenericDINode *N) : MDNodeOpsKey(N, 1), Tag(N->getTag()), Header(N->getHeader()) {} - bool isKeyOf(const GenericDebugNode *RHS) const { + bool isKeyOf(const GenericDINode *RHS) const { return Tag == RHS->getTag() && Header == RHS->getHeader() && compareOps(RHS, 1); } unsigned getHashValue() const { return hash_combine(getHash(), Tag, Header); } - static unsigned calculateHash(GenericDebugNode *N) { + static unsigned calculateHash(GenericDINode *N) { return MDNodeOpsKey::calculateHash(N, 1); } }; -template <> struct MDNodeKeyImpl<MDSubrange> { +template <> struct MDNodeKeyImpl<DISubrange> { int64_t Count; int64_t LowerBound; MDNodeKeyImpl(int64_t Count, int64_t LowerBound) : Count(Count), LowerBound(LowerBound) {} - MDNodeKeyImpl(const MDSubrange *N) + MDNodeKeyImpl(const DISubrange *N) : Count(N->getCount()), LowerBound(N->getLowerBound()) {} - bool isKeyOf(const MDSubrange *RHS) const { + bool isKeyOf(const DISubrange *RHS) const { return Count == RHS->getCount() && LowerBound == RHS->getLowerBound(); } unsigned getHashValue() const { return hash_combine(Count, LowerBound); } }; -template <> struct MDNodeKeyImpl<MDEnumerator> { +template <> struct MDNodeKeyImpl<DIEnumerator> { int64_t Value; StringRef Name; MDNodeKeyImpl(int64_t Value, StringRef Name) : Value(Value), Name(Name) {} - MDNodeKeyImpl(const MDEnumerator *N) + MDNodeKeyImpl(const DIEnumerator *N) : Value(N->getValue()), Name(N->getName()) {} - bool isKeyOf(const MDEnumerator *RHS) const { + bool isKeyOf(const DIEnumerator *RHS) const { return Value == RHS->getValue() && Name == RHS->getName(); } unsigned getHashValue() const { return hash_combine(Value, Name); } }; -template <> struct MDNodeKeyImpl<MDBasicType> { +template <> struct MDNodeKeyImpl<DIBasicType> { unsigned Tag; StringRef Name; uint64_t SizeInBits; @@ -313,11 +313,11 @@ template <> struct MDNodeKeyImpl<MDBasicType> { uint64_t AlignInBits, unsigned Encoding) : Tag(Tag), Name(Name), SizeInBits(SizeInBits), AlignInBits(AlignInBits), Encoding(Encoding) {} - MDNodeKeyImpl(const MDBasicType *N) + MDNodeKeyImpl(const DIBasicType *N) : Tag(N->getTag()), Name(N->getName()), SizeInBits(N->getSizeInBits()), AlignInBits(N->getAlignInBits()), Encoding(N->getEncoding()) {} - bool isKeyOf(const MDBasicType *RHS) const { + bool isKeyOf(const DIBasicType *RHS) const { return Tag == RHS->getTag() && Name == RHS->getName() && SizeInBits == RHS->getSizeInBits() && AlignInBits == RHS->getAlignInBits() && @@ -328,7 +328,7 @@ template <> struct MDNodeKeyImpl<MDBasicType> { } }; -template <> struct MDNodeKeyImpl<MDDerivedType> { +template <> struct MDNodeKeyImpl<DIDerivedType> { unsigned Tag; StringRef Name; Metadata *File; @@ -348,14 +348,14 @@ template <> struct MDNodeKeyImpl<MDDerivedType> { : Tag(Tag), Name(Name), File(File), Line(Line), Scope(Scope), BaseType(BaseType), SizeInBits(SizeInBits), AlignInBits(AlignInBits), OffsetInBits(OffsetInBits), Flags(Flags), ExtraData(ExtraData) {} - MDNodeKeyImpl(const MDDerivedType *N) + MDNodeKeyImpl(const DIDerivedType *N) : Tag(N->getTag()), Name(N->getName()), File(N->getRawFile()), Line(N->getLine()), Scope(N->getRawScope()), BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()), AlignInBits(N->getAlignInBits()), OffsetInBits(N->getOffsetInBits()), Flags(N->getFlags()), ExtraData(N->getRawExtraData()) {} - bool isKeyOf(const MDDerivedType *RHS) const { + bool isKeyOf(const DIDerivedType *RHS) const { return Tag == RHS->getTag() && Name == RHS->getName() && File == RHS->getRawFile() && Line == RHS->getLine() && Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() && @@ -370,7 +370,7 @@ template <> struct MDNodeKeyImpl<MDDerivedType> { } }; -template <> struct MDNodeKeyImpl<MDCompositeType> { +template <> struct MDNodeKeyImpl<DICompositeType> { unsigned Tag; StringRef Name; Metadata *File; @@ -398,7 +398,7 @@ template <> struct MDNodeKeyImpl<MDCompositeType> { OffsetInBits(OffsetInBits), Flags(Flags), Elements(Elements), RuntimeLang(RuntimeLang), VTableHolder(VTableHolder), TemplateParams(TemplateParams), Identifier(Identifier) {} - MDNodeKeyImpl(const MDCompositeType *N) + MDNodeKeyImpl(const DICompositeType *N) : Tag(N->getTag()), Name(N->getName()), File(N->getRawFile()), Line(N->getLine()), Scope(N->getRawScope()), BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()), @@ -408,7 +408,7 @@ template <> struct MDNodeKeyImpl<MDCompositeType> { TemplateParams(N->getRawTemplateParams()), Identifier(N->getIdentifier()) {} - bool isKeyOf(const MDCompositeType *RHS) const { + bool isKeyOf(const DICompositeType *RHS) const { return Tag == RHS->getTag() && Name == RHS->getName() && File == RHS->getRawFile() && Line == RHS->getLine() && Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() && @@ -428,37 +428,37 @@ template <> struct MDNodeKeyImpl<MDCompositeType> { } }; -template <> struct MDNodeKeyImpl<MDSubroutineType> { +template <> struct MDNodeKeyImpl<DISubroutineType> { unsigned Flags; Metadata *TypeArray; MDNodeKeyImpl(int64_t Flags, Metadata *TypeArray) : Flags(Flags), TypeArray(TypeArray) {} - MDNodeKeyImpl(const MDSubroutineType *N) + MDNodeKeyImpl(const DISubroutineType *N) : Flags(N->getFlags()), TypeArray(N->getRawTypeArray()) {} - bool isKeyOf(const MDSubroutineType *RHS) const { + bool isKeyOf(const DISubroutineType *RHS) const { return Flags == RHS->getFlags() && TypeArray == RHS->getRawTypeArray(); } unsigned getHashValue() const { return hash_combine(Flags, TypeArray); } }; -template <> struct MDNodeKeyImpl<MDFile> { +template <> struct MDNodeKeyImpl<DIFile> { StringRef Filename; StringRef Directory; MDNodeKeyImpl(StringRef Filename, StringRef Directory) : Filename(Filename), Directory(Directory) {} - MDNodeKeyImpl(const MDFile *N) + MDNodeKeyImpl(const DIFile *N) : Filename(N->getFilename()), Directory(N->getDirectory()) {} - bool isKeyOf(const MDFile *RHS) const { + bool isKeyOf(const DIFile *RHS) const { return Filename == RHS->getFilename() && Directory == RHS->getDirectory(); } unsigned getHashValue() const { return hash_combine(Filename, Directory); } }; -template <> struct MDNodeKeyImpl<MDCompileUnit> { +template <> struct MDNodeKeyImpl<DICompileUnit> { unsigned SourceLanguage; Metadata *File; StringRef Producer; @@ -485,7 +485,7 @@ template <> struct MDNodeKeyImpl<MDCompileUnit> { EnumTypes(EnumTypes), RetainedTypes(RetainedTypes), Subprograms(Subprograms), GlobalVariables(GlobalVariables), ImportedEntities(ImportedEntities) {} - MDNodeKeyImpl(const MDCompileUnit *N) + MDNodeKeyImpl(const DICompileUnit *N) : SourceLanguage(N->getSourceLanguage()), File(N->getRawFile()), Producer(N->getProducer()), IsOptimized(N->isOptimized()), Flags(N->getFlags()), RuntimeVersion(N->getRuntimeVersion()), @@ -496,7 +496,7 @@ template <> struct MDNodeKeyImpl<MDCompileUnit> { GlobalVariables(N->getRawGlobalVariables()), ImportedEntities(N->getRawImportedEntities()) {} - bool isKeyOf(const MDCompileUnit *RHS) const { + bool isKeyOf(const DICompileUnit *RHS) const { return SourceLanguage == RHS->getSourceLanguage() && File == RHS->getRawFile() && Producer == RHS->getProducer() && IsOptimized == RHS->isOptimized() && Flags == RHS->getFlags() && @@ -517,7 +517,7 @@ template <> struct MDNodeKeyImpl<MDCompileUnit> { } }; -template <> struct MDNodeKeyImpl<MDSubprogram> { +template <> struct MDNodeKeyImpl<DISubprogram> { Metadata *Scope; StringRef Name; StringRef LinkageName; @@ -551,7 +551,7 @@ template <> struct MDNodeKeyImpl<MDSubprogram> { VirtualIndex(VirtualIndex), Flags(Flags), IsOptimized(IsOptimized), Function(Function), TemplateParams(TemplateParams), Declaration(Declaration), Variables(Variables) {} - MDNodeKeyImpl(const MDSubprogram *N) + MDNodeKeyImpl(const DISubprogram *N) : Scope(N->getRawScope()), Name(N->getName()), LinkageName(N->getLinkageName()), File(N->getRawFile()), Line(N->getLine()), Type(N->getRawType()), @@ -563,7 +563,7 @@ template <> struct MDNodeKeyImpl<MDSubprogram> { TemplateParams(N->getRawTemplateParams()), Declaration(N->getRawDeclaration()), Variables(N->getRawVariables()) {} - bool isKeyOf(const MDSubprogram *RHS) const { + bool isKeyOf(const DISubprogram *RHS) const { return Scope == RHS->getRawScope() && Name == RHS->getName() && LinkageName == RHS->getLinkageName() && File == RHS->getRawFile() && Line == RHS->getLine() && Type == RHS->getRawType() && @@ -587,7 +587,7 @@ template <> struct MDNodeKeyImpl<MDSubprogram> { } }; -template <> struct MDNodeKeyImpl<MDLexicalBlock> { +template <> struct MDNodeKeyImpl<DILexicalBlock> { Metadata *Scope; Metadata *File; unsigned Line; @@ -595,11 +595,11 @@ template <> struct MDNodeKeyImpl<MDLexicalBlock> { MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Line, unsigned Column) : Scope(Scope), File(File), Line(Line), Column(Column) {} - MDNodeKeyImpl(const MDLexicalBlock *N) + MDNodeKeyImpl(const DILexicalBlock *N) : Scope(N->getRawScope()), File(N->getRawFile()), Line(N->getLine()), Column(N->getColumn()) {} - bool isKeyOf(const MDLexicalBlock *RHS) const { + bool isKeyOf(const DILexicalBlock *RHS) const { return Scope == RHS->getRawScope() && File == RHS->getRawFile() && Line == RHS->getLine() && Column == RHS->getColumn(); } @@ -608,18 +608,18 @@ template <> struct MDNodeKeyImpl<MDLexicalBlock> { } }; -template <> struct MDNodeKeyImpl<MDLexicalBlockFile> { +template <> struct MDNodeKeyImpl<DILexicalBlockFile> { Metadata *Scope; Metadata *File; unsigned Discriminator; MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Discriminator) : Scope(Scope), File(File), Discriminator(Discriminator) {} - MDNodeKeyImpl(const MDLexicalBlockFile *N) + MDNodeKeyImpl(const DILexicalBlockFile *N) : Scope(N->getRawScope()), File(N->getRawFile()), Discriminator(N->getDiscriminator()) {} - bool isKeyOf(const MDLexicalBlockFile *RHS) const { + bool isKeyOf(const DILexicalBlockFile *RHS) const { return Scope == RHS->getRawScope() && File == RHS->getRawFile() && Discriminator == RHS->getDiscriminator(); } @@ -628,7 +628,7 @@ template <> struct MDNodeKeyImpl<MDLexicalBlockFile> { } }; -template <> struct MDNodeKeyImpl<MDNamespace> { +template <> struct MDNodeKeyImpl<DINamespace> { Metadata *Scope; Metadata *File; StringRef Name; @@ -636,11 +636,11 @@ template <> struct MDNodeKeyImpl<MDNamespace> { MDNodeKeyImpl(Metadata *Scope, Metadata *File, StringRef Name, unsigned Line) : Scope(Scope), File(File), Name(Name), Line(Line) {} - MDNodeKeyImpl(const MDNamespace *N) + MDNodeKeyImpl(const DINamespace *N) : Scope(N->getRawScope()), File(N->getRawFile()), Name(N->getName()), Line(N->getLine()) {} - bool isKeyOf(const MDNamespace *RHS) const { + bool isKeyOf(const DINamespace *RHS) const { return Scope == RHS->getRawScope() && File == RHS->getRawFile() && Name == RHS->getName() && Line == RHS->getLine(); } @@ -649,21 +649,21 @@ template <> struct MDNodeKeyImpl<MDNamespace> { } }; -template <> struct MDNodeKeyImpl<MDTemplateTypeParameter> { +template <> struct MDNodeKeyImpl<DITemplateTypeParameter> { StringRef Name; Metadata *Type; MDNodeKeyImpl(StringRef Name, Metadata *Type) : Name(Name), Type(Type) {} - MDNodeKeyImpl(const MDTemplateTypeParameter *N) + MDNodeKeyImpl(const DITemplateTypeParameter *N) : Name(N->getName()), Type(N->getRawType()) {} - bool isKeyOf(const MDTemplateTypeParameter *RHS) const { + bool isKeyOf(const DITemplateTypeParameter *RHS) const { return Name == RHS->getName() && Type == RHS->getRawType(); } unsigned getHashValue() const { return hash_combine(Name, Type); } }; -template <> struct MDNodeKeyImpl<MDTemplateValueParameter> { +template <> struct MDNodeKeyImpl<DITemplateValueParameter> { unsigned Tag; StringRef Name; Metadata *Type; @@ -671,18 +671,18 @@ template <> struct MDNodeKeyImpl<MDTemplateValueParameter> { MDNodeKeyImpl(unsigned Tag, StringRef Name, Metadata *Type, Metadata *Value) : Tag(Tag), Name(Name), Type(Type), Value(Value) {} - MDNodeKeyImpl(const MDTemplateValueParameter *N) + MDNodeKeyImpl(const DITemplateValueParameter *N) : Tag(N->getTag()), Name(N->getName()), Type(N->getRawType()), Value(N->getValue()) {} - bool isKeyOf(const MDTemplateValueParameter *RHS) const { + bool isKeyOf(const DITemplateValueParameter *RHS) const { return Tag == RHS->getTag() && Name == RHS->getName() && Type == RHS->getRawType() && Value == RHS->getValue(); } unsigned getHashValue() const { return hash_combine(Tag, Name, Type, Value); } }; -template <> struct MDNodeKeyImpl<MDGlobalVariable> { +template <> struct MDNodeKeyImpl<DIGlobalVariable> { Metadata *Scope; StringRef Name; StringRef LinkageName; @@ -702,7 +702,7 @@ template <> struct MDNodeKeyImpl<MDGlobalVariable> { Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition), Variable(Variable), StaticDataMemberDeclaration(StaticDataMemberDeclaration) {} - MDNodeKeyImpl(const MDGlobalVariable *N) + MDNodeKeyImpl(const DIGlobalVariable *N) : Scope(N->getRawScope()), Name(N->getName()), LinkageName(N->getLinkageName()), File(N->getRawFile()), Line(N->getLine()), Type(N->getRawType()), @@ -710,7 +710,7 @@ template <> struct MDNodeKeyImpl<MDGlobalVariable> { Variable(N->getRawVariable()), StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()) {} - bool isKeyOf(const MDGlobalVariable *RHS) const { + bool isKeyOf(const DIGlobalVariable *RHS) const { return Scope == RHS->getRawScope() && Name == RHS->getName() && LinkageName == RHS->getLinkageName() && File == RHS->getRawFile() && Line == RHS->getLine() && Type == RHS->getRawType() && @@ -727,7 +727,7 @@ template <> struct MDNodeKeyImpl<MDGlobalVariable> { } }; -template <> struct MDNodeKeyImpl<MDLocalVariable> { +template <> struct MDNodeKeyImpl<DILocalVariable> { unsigned Tag; Metadata *Scope; StringRef Name; @@ -741,12 +741,12 @@ template <> struct MDNodeKeyImpl<MDLocalVariable> { unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags) : Tag(Tag), Scope(Scope), Name(Name), File(File), Line(Line), Type(Type), Arg(Arg), Flags(Flags) {} - MDNodeKeyImpl(const MDLocalVariable *N) + MDNodeKeyImpl(const DILocalVariable *N) : Tag(N->getTag()), Scope(N->getRawScope()), Name(N->getName()), File(N->getRawFile()), Line(N->getLine()), Type(N->getRawType()), Arg(N->getArg()), Flags(N->getFlags()) {} - bool isKeyOf(const MDLocalVariable *RHS) const { + bool isKeyOf(const DILocalVariable *RHS) const { return Tag == RHS->getTag() && Scope == RHS->getRawScope() && Name == RHS->getName() && File == RHS->getRawFile() && Line == RHS->getLine() && Type == RHS->getRawType() && @@ -757,13 +757,13 @@ template <> struct MDNodeKeyImpl<MDLocalVariable> { } }; -template <> struct MDNodeKeyImpl<MDExpression> { +template <> struct MDNodeKeyImpl<DIExpression> { ArrayRef<uint64_t> Elements; MDNodeKeyImpl(ArrayRef<uint64_t> Elements) : Elements(Elements) {} - MDNodeKeyImpl(const MDExpression *N) : Elements(N->getElements()) {} + MDNodeKeyImpl(const DIExpression *N) : Elements(N->getElements()) {} - bool isKeyOf(const MDExpression *RHS) const { + bool isKeyOf(const DIExpression *RHS) const { return Elements == RHS->getElements(); } unsigned getHashValue() const { @@ -771,7 +771,7 @@ template <> struct MDNodeKeyImpl<MDExpression> { } }; -template <> struct MDNodeKeyImpl<MDObjCProperty> { +template <> struct MDNodeKeyImpl<DIObjCProperty> { StringRef Name; Metadata *File; unsigned Line; @@ -785,12 +785,12 @@ template <> struct MDNodeKeyImpl<MDObjCProperty> { Metadata *Type) : Name(Name), File(File), Line(Line), GetterName(GetterName), SetterName(SetterName), Attributes(Attributes), Type(Type) {} - MDNodeKeyImpl(const MDObjCProperty *N) + MDNodeKeyImpl(const DIObjCProperty *N) : Name(N->getName()), File(N->getRawFile()), Line(N->getLine()), GetterName(N->getGetterName()), SetterName(N->getSetterName()), Attributes(N->getAttributes()), Type(N->getRawType()) {} - bool isKeyOf(const MDObjCProperty *RHS) const { + bool isKeyOf(const DIObjCProperty *RHS) const { return Name == RHS->getName() && File == RHS->getRawFile() && Line == RHS->getLine() && GetterName == RHS->getGetterName() && SetterName == RHS->getSetterName() && @@ -802,7 +802,7 @@ template <> struct MDNodeKeyImpl<MDObjCProperty> { } }; -template <> struct MDNodeKeyImpl<MDImportedEntity> { +template <> struct MDNodeKeyImpl<DIImportedEntity> { unsigned Tag; Metadata *Scope; Metadata *Entity; @@ -812,11 +812,11 @@ template <> struct MDNodeKeyImpl<MDImportedEntity> { MDNodeKeyImpl(unsigned Tag, Metadata *Scope, Metadata *Entity, unsigned Line, StringRef Name) : Tag(Tag), Scope(Scope), Entity(Entity), Line(Line), Name(Name) {} - MDNodeKeyImpl(const MDImportedEntity *N) + MDNodeKeyImpl(const DIImportedEntity *N) : Tag(N->getTag()), Scope(N->getRawScope()), Entity(N->getRawEntity()), Line(N->getLine()), Name(N->getName()) {} - bool isKeyOf(const MDImportedEntity *RHS) const { + bool isKeyOf(const DIImportedEntity *RHS) const { return Tag == RHS->getTag() && Scope == RHS->getRawScope() && Entity == RHS->getRawEntity() && Line == RHS->getLine() && Name == RHS->getName(); diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index afce3e2bf56..3ccc48e3ffd 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -305,11 +305,11 @@ private: template <class Ty> bool isValidMetadataArray(const MDTuple &N); #define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS) void visit##CLASS(const CLASS &N); #include "llvm/IR/Metadata.def" - void visitMDScope(const MDScope &N); - void visitMDDerivedTypeBase(const MDDerivedTypeBase &N); - void visitMDVariable(const MDVariable &N); - void visitMDLexicalBlockBase(const MDLexicalBlockBase &N); - void visitMDTemplateParameter(const MDTemplateParameter &N); + void visitDIScope(const DIScope &N); + void visitDIDerivedTypeBase(const DIDerivedTypeBase &N); + void visitDIVariable(const DIVariable &N); + void visitDILexicalBlockBase(const DILexicalBlockBase &N); + void visitDITemplateParameter(const DITemplateParameter &N); void visitTemplateParams(const MDNode &N, const Metadata &RawParams); @@ -321,17 +321,17 @@ private: /// \brief Check for a valid type reference. /// - /// Checks for subclasses of \a MDType, or \a isValidUUID(). + /// Checks for subclasses of \a DIType, or \a isValidUUID(). bool isTypeRef(const MDNode &N, const Metadata *MD); /// \brief Check for a valid scope reference. /// - /// Checks for subclasses of \a MDScope, or \a isValidUUID(). + /// Checks for subclasses of \a DIScope, or \a isValidUUID(). bool isScopeRef(const MDNode &N, const Metadata *MD); /// \brief Check for a valid debug info reference. /// - /// Checks for subclasses of \a DebugNode, or \a isValidUUID(). + /// Checks for subclasses of \a DINode, or \a isValidUUID(). bool isDIRef(const MDNode &N, const Metadata *MD); // InstVisitor overrides... @@ -605,7 +605,7 @@ void Verifier::visitNamedMDNode(const NamedMDNode &NMD) { MDNode *MD = NMD.getOperand(i); if (NMD.getName() == "llvm.dbg.cu") { - Assert(MD && isa<MDCompileUnit>(MD), "invalid compile unit", &NMD, MD); + Assert(MD && isa<DICompileUnit>(MD), "invalid compile unit", &NMD, MD); } if (!MD) @@ -711,17 +711,17 @@ bool Verifier::isValidUUID(const MDNode &N, const Metadata *MD) { /// \brief Check if a value can be a reference to a type. bool Verifier::isTypeRef(const MDNode &N, const Metadata *MD) { - return !MD || isValidUUID(N, MD) || isa<MDType>(MD); + return !MD || isValidUUID(N, MD) || isa<DIType>(MD); } /// \brief Check if a value can be a ScopeRef. bool Verifier::isScopeRef(const MDNode &N, const Metadata *MD) { - return !MD || isValidUUID(N, MD) || isa<MDScope>(MD); + return !MD || isValidUUID(N, MD) || isa<DIScope>(MD); } /// \brief Check if a value can be a debug info ref. bool Verifier::isDIRef(const MDNode &N, const Metadata *MD) { - return !MD || isValidUUID(N, MD) || isa<DebugNode>(MD); + return !MD || isValidUUID(N, MD) || isa<DINode>(MD); } template <class Ty> @@ -748,40 +748,40 @@ bool isValidMetadataNullArray(const MDTuple &N) { return isValidMetadataArrayImpl<Ty>(N, /* AllowNull */ true); } -void Verifier::visitMDLocation(const MDLocation &N) { - Assert(N.getRawScope() && isa<MDLocalScope>(N.getRawScope()), +void Verifier::visitDILocation(const DILocation &N) { + Assert(N.getRawScope() && isa<DILocalScope>(N.getRawScope()), "location requires a valid scope", &N, N.getRawScope()); if (auto *IA = N.getRawInlinedAt()) - Assert(isa<MDLocation>(IA), "inlined-at should be a location", &N, IA); + Assert(isa<DILocation>(IA), "inlined-at should be a location", &N, IA); } -void Verifier::visitGenericDebugNode(const GenericDebugNode &N) { +void Verifier::visitGenericDINode(const GenericDINode &N) { Assert(N.getTag(), "invalid tag", &N); } -void Verifier::visitMDScope(const MDScope &N) { +void Verifier::visitDIScope(const DIScope &N) { if (auto *F = N.getRawFile()) - Assert(isa<MDFile>(F), "invalid file", &N, F); + Assert(isa<DIFile>(F), "invalid file", &N, F); } -void Verifier::visitMDSubrange(const MDSubrange &N) { +void Verifier::visitDISubrange(const DISubrange &N) { Assert(N.getTag() == dwarf::DW_TAG_subrange_type, "invalid tag", &N); Assert(N.getCount() >= -1, "invalid subrange count", &N); } -void Verifier::visitMDEnumerator(const MDEnumerator &N) { +void Verifier::visitDIEnumerator(const DIEnumerator &N) { Assert(N.getTag() == dwarf::DW_TAG_enumerator, "invalid tag", &N); } -void Verifier::visitMDBasicType(const MDBasicType &N) { +void Verifier::visitDIBasicType(const DIBasicType &N) { Assert(N.getTag() == dwarf::DW_TAG_base_type || N.getTag() == dwarf::DW_TAG_unspecified_type, "invalid tag", &N); } -void Verifier::visitMDDerivedTypeBase(const MDDerivedTypeBase &N) { +void Verifier::visitDIDerivedTypeBase(const DIDerivedTypeBase &N) { // Common scope checks. - visitMDScope(N); + visitDIScope(N); Assert(isScopeRef(N, N.getScope()), "invalid scope", &N, N.getScope()); Assert(isTypeRef(N, N.getBaseType()), "invalid base type", &N, @@ -808,9 +808,9 @@ void Verifier::visitMDDerivedTypeBase(const MDDerivedTypeBase &N) { } } -void Verifier::visitMDDerivedType(const MDDerivedType &N) { +void Verifier::visitDIDerivedType(const DIDerivedType &N) { // Common derived type checks. - visitMDDerivedTypeBase(N); + visitDIDerivedTypeBase(N); Assert(N.getTag() == dwarf::DW_TAG_typedef || N.getTag() == dwarf::DW_TAG_pointer_type || @@ -831,22 +831,22 @@ void Verifier::visitMDDerivedType(const MDDerivedType &N) { } static bool hasConflictingReferenceFlags(unsigned Flags) { - return (Flags & DebugNode::FlagLValueReference) && - (Flags & DebugNode::FlagRValueReference); + return (Flags & DINode::FlagLValueReference) && + (Flags & DINode::FlagRValueReference); } void Verifier::visitTemplateParams(const MDNode &N, const Metadata &RawParams) { auto *Params = dyn_cast<MDTuple>(&RawParams); Assert(Params, "invalid template params", &N, &RawParams); for (Metadata *Op : Params->operands()) { - Assert(Op && isa<MDTemplateParameter>(Op), "invalid template parameter", &N, + Assert(Op && isa<DITemplateParameter>(Op), "invalid template parameter", &N, Params, Op); } } -void Verifier::visitMDCompositeType(const MDCompositeType &N) { +void Verifier::visitDICompositeType(const DICompositeType &N) { // Common derived type checks. - visitMDDerivedTypeBase(N); + visitDIDerivedTypeBase(N); Assert(N.getTag() == dwarf::DW_TAG_array_type || N.getTag() == dwarf::DW_TAG_structure_type || @@ -868,7 +868,7 @@ void Verifier::visitMDCompositeType(const MDCompositeType &N) { visitTemplateParams(N, *Params); } -void Verifier::visitMDSubroutineType(const MDSubroutineType &N) { +void Verifier::visitDISubroutineType(const DISubroutineType &N) { Assert(N.getTag() == dwarf::DW_TAG_subroutine_type, "invalid tag", &N); if (auto *Types = N.getRawTypeArray()) { Assert(isa<MDTuple>(Types), "invalid composite elements", &N, Types); @@ -880,24 +880,24 @@ void Verifier::visitMDSubroutineType(const MDSubroutineType &N) { &N); } -void Verifier::visitMDFile(const MDFile &N) { +void Verifier::visitDIFile(const DIFile &N) { Assert(N.getTag() == dwarf::DW_TAG_file_type, "invalid tag", &N); } -void Verifier::visitMDCompileUnit(const MDCompileUnit &N) { +void Verifier::visitDICompileUnit(const DICompileUnit &N) { Assert(N.getTag() == dwarf::DW_TAG_compile_unit, "invalid tag", &N); // Don't bother verifying the compilation directory or producer string // as those could be empty. - Assert(N.getRawFile() && isa<MDFile>(N.getRawFile()), - "invalid file", &N, N.getRawFile()); + Assert(N.getRawFile() && isa<DIFile>(N.getRawFile()), "invalid file", &N, + N.getRawFile()); Assert(!N.getFile()->getFilename().empty(), "invalid filename", &N, N.getFile()); if (auto *Array = N.getRawEnumTypes()) { Assert(isa<MDTuple>(Array), "invalid enum list", &N, Array); for (Metadata *Op : N.getEnumTypes()->operands()) { - auto *Enum = dyn_cast_or_null<MDCompositeType>(Op); + auto *Enum = dyn_cast_or_null<DICompositeType>(Op); Assert(Enum && Enum->getTag() == dwarf::DW_TAG_enumeration_type, "invalid enum type", &N, N.getEnumTypes(), Op); } @@ -905,36 +905,36 @@ void Verifier::visitMDCompileUnit(const MDCompileUnit &N) { if (auto *Array = N.getRawRetainedTypes()) { Assert(isa<MDTuple>(Array), "invalid retained type list", &N, Array); for (Metadata *Op : N.getRetainedTypes()->operands()) { - Assert(Op && isa<MDType>(Op), "invalid retained type", &N, Op); + Assert(Op && isa<DIType>(Op), "invalid retained type", &N, Op); } } if (auto *Array = N.getRawSubprograms()) { Assert(isa<MDTuple>(Array), "invalid subprogram list", &N, Array); for (Metadata *Op : N.getSubprograms()->operands()) { - Assert(Op && isa<MDSubprogram>(Op), "invalid subprogram ref", &N, Op); + Assert(Op && isa<DISubprogram>(Op), "invalid subprogram ref", &N, Op); } } if (auto *Array = N.getRawGlobalVariables()) { Assert(isa<MDTuple>(Array), "invalid global variable list", &N, Array); for (Metadata *Op : N.getGlobalVariables()->operands()) { - Assert(Op && isa<MDGlobalVariable>(Op), "invalid global variable ref", &N, + Assert(Op && isa<DIGlobalVariable>(Op), "invalid global variable ref", &N, Op); } } if (auto *Array = N.getRawImportedEntities()) { Assert(isa<MDTuple>(Array), "invalid imported entity list", &N, Array); for (Metadata *Op : N.getImportedEntities()->operands()) { - Assert(Op && isa<MDImportedEntity>(Op), "invalid imported entity ref", &N, + Assert(Op && isa<DIImportedEntity>(Op), "invalid imported entity ref", &N, Op); } } } -void Verifier::visitMDSubprogram(const MDSubprogram &N) { +void Verifier::visitDISubprogram(const DISubprogram &N) { Assert(N.getTag() == dwarf::DW_TAG_subprogram, "invalid tag", &N); Assert(isScopeRef(N, N.getRawScope()), "invalid scope", &N, N.getRawScope()); if (auto *T = N.getRawType()) - Assert(isa<MDSubroutineType>(T), "invalid subroutine type", &N, T); + Assert(isa<DISubroutineType>(T), "invalid subroutine type", &N, T); Assert(isTypeRef(N, N.getRawContainingType()), "invalid containing type", &N, N.getRawContainingType()); if (auto *RawF = N.getRawFunction()) { @@ -947,14 +947,14 @@ void Verifier::visitMDSubprogram(const MDSubprogram &N) { if (auto *Params = N.getRawTemplateParams()) visitTemplateParams(N, *Params); if (auto *S = N.getRawDeclaration()) { - Assert(isa<MDSubprogram>(S) && !cast<MDSubprogram>(S)->isDefinition(), + Assert(isa<DISubprogram>(S) && !cast<DISubprogram>(S)->isDefinition(), "invalid subprogram declaration", &N, S); } if (auto *RawVars = N.getRawVariables()) { auto *Vars = dyn_cast<MDTuple>(RawVars); Assert(Vars, "invalid variable list", &N, RawVars); for (Metadata *Op : Vars->operands()) { - Assert(Op && isa<MDLocalVariable>(Op), "invalid local variable", &N, Vars, + Assert(Op && isa<DILocalVariable>(Op), "invalid local variable", &N, Vars, Op); } } @@ -973,20 +973,20 @@ void Verifier::visitMDSubprogram(const MDSubprogram &N) { SmallPtrSet<const MDNode *, 32> Seen; for (auto &BB : *F) for (auto &I : BB) { - // Be careful about using MDLocation here since we might be dealing with + // Be careful about using DILocation here since we might be dealing with // broken code (this is the Verifier after all). - MDLocation *DL = - dyn_cast_or_null<MDLocation>(I.getDebugLoc().getAsMDNode()); + DILocation *DL = + dyn_cast_or_null<DILocation>(I.getDebugLoc().getAsMDNode()); if (!DL) continue; if (!Seen.insert(DL).second) continue; - MDLocalScope *Scope = DL->getInlinedAtScope(); + DILocalScope *Scope = DL->getInlinedAtScope(); if (Scope && !Seen.insert(Scope).second) continue; - MDSubprogram *SP = Scope ? Scope->getSubprogram() : nullptr; + DISubprogram *SP = Scope ? Scope->getSubprogram() : nullptr; if (SP && !Seen.insert(SP).second) continue; @@ -997,43 +997,43 @@ void Verifier::visitMDSubprogram(const MDSubprogram &N) { } } -void Verifier::visitMDLexicalBlockBase(const MDLexicalBlockBase &N) { +void Verifier::visitDILexicalBlockBase(const DILexicalBlockBase &N) { Assert(N.getTag() == dwarf::DW_TAG_lexical_block, "invalid tag", &N); - Assert(N.getRawScope() && isa<MDLocalScope>(N.getRawScope()), + Assert(N.getRawScope() && isa<DILocalScope>(N.getRawScope()), "invalid local scope", &N, N.getRawScope()); } -void Verifier::visitMDLexicalBlock(const MDLexicalBlock &N) { - visitMDLexicalBlockBase(N); +void Verifier::visitDILexicalBlock(const DILexicalBlock &N) { + visitDILexicalBlockBase(N); Assert(N.getLine() || !N.getColumn(), "cannot have column info without line info", &N); } -void Verifier::visitMDLexicalBlockFile(const MDLexicalBlockFile &N) { - visitMDLexicalBlockBase(N); +void Verifier::visitDILexicalBlockFile(const DILexicalBlockFile &N) { + visitDILexicalBlockBase(N); } -void Verifier::visitMDNamespace(const MDNamespace &N) { +void Verifier::visitDINamespace(const DINamespace &N) { Assert(N.getTag() == dwarf::DW_TAG_namespace, "invalid tag", &N); if (auto *S = N.getRawScope()) - Assert(isa<MDScope>(S), "invalid scope ref", &N, S); + Assert(isa<DIScope>(S), "invalid scope ref", &N, S); } -void Verifier::visitMDTemplateParameter(const MDTemplateParameter &N) { +void Verifier::visitDITemplateParameter(const DITemplateParameter &N) { Assert(isTypeRef(N, N.getType()), "invalid type ref", &N, N.getType()); } -void Verifier::visitMDTemplateTypeParameter(const MDTemplateTypeParameter &N) { - visitMDTemplateParameter(N); +void Verifier::visitDITemplateTypeParameter(const DITemplateTypeParameter &N) { + visitDITemplateParameter(N); Assert(N.getTag() == dwarf::DW_TAG_template_type_parameter, "invalid tag", &N); } -void Verifier::visitMDTemplateValueParameter( - const MDTemplateValueParameter &N) { - visitMDTemplateParameter(N); +void Verifier::visitDITemplateValueParameter( + const DITemplateValueParameter &N) { + visitDITemplateParameter(N); Assert(N.getTag() == dwarf::DW_TAG_template_value_parameter || N.getTag() == dwarf::DW_TAG_GNU_template_template_param || @@ -1041,17 +1041,17 @@ void Verifier::visitMDTemplateValueParameter( "invalid tag", &N); } -void Verifier::visitMDVariable(const MDVariable &N) { +void Verifier::visitDIVariable(const DIVariable &N) { if (auto *S = N.getRawScope()) - Assert(isa<MDScope>(S), "invalid scope", &N, S); + Assert(isa<DIScope>(S), "invalid scope", &N, S); Assert(isTypeRef(N, N.getRawType()), "invalid type ref", &N, N.getRawType()); if (auto *F = N.getRawFile()) - Assert(isa<MDFile>(F), "invalid file", &N, F); + Assert(isa<DIFile>(F), "invalid file", &N, F); } -void Verifier::visitMDGlobalVariable(const MDGlobalVariable &N) { +void Verifier::visitDIGlobalVariable(const DIGlobalVariable &N) { // Checks common to all variables. - visitMDVariable(N); + visitDIVariable(N); Assert(N.getTag() == dwarf::DW_TAG_variable, "invalid tag", &N); Assert(!N.getName().empty(), "missing global variable name", &N); @@ -1061,40 +1061,40 @@ void Verifier::visitMDGlobalVariable(const MDGlobalVariable &N) { "invalid global varaible ref", &N, V); } if (auto *Member = N.getRawStaticDataMemberDeclaration()) { - Assert(isa<MDDerivedType>(Member), "invalid static data member declaration", + Assert(isa<DIDerivedType>(Member), "invalid static data member declaration", &N, Member); } } -void Verifier::visitMDLocalVariable(const MDLocalVariable &N) { +void Verifier::visitDILocalVariable(const DILocalVariable &N) { // Checks common to all variables. - visitMDVariable(N); + visitDIVariable(N); Assert(N.getTag() == dwarf::DW_TAG_auto_variable || N.getTag() == dwarf::DW_TAG_arg_variable, "invalid tag", &N); - Assert(N.getRawScope() && isa<MDLocalScope>(N.getRawScope()), + Assert(N.getRawScope() && isa<DILocalScope>(N.getRawScope()), "local variable requires a valid scope", &N, N.getRawScope()); } -void Verifier::visitMDExpression(const MDExpression &N) { +void Verifier::visitDIExpression(const DIExpression &N) { Assert(N.isValid(), "invalid expression", &N); } -void Verifier::visitMDObjCProperty(const MDObjCProperty &N) { +void Verifier::visitDIObjCProperty(const DIObjCProperty &N) { Assert(N.getTag() == dwarf::DW_TAG_APPLE_property, "invalid tag", &N); if (auto *T = N.getRawType()) - Assert(isa<MDType>(T), "invalid type ref", &N, T); + Assert(isa<DIType>(T), "invalid type ref", &N, T); if (auto *F = N.getRawFile()) - Assert(isa<MDFile>(F), "invalid file", &N, F); + Assert(isa<DIFile>(F), "invalid file", &N, F); } -void Verifier::visitMDImportedEntity(const MDImportedEntity &N) { +void Verifier::visitDIImportedEntity(const DIImportedEntity &N) { Assert(N.getTag() == dwarf::DW_TAG_imported_module || N.getTag() == dwarf::DW_TAG_imported_declaration, "invalid tag", &N); if (auto *S = N.getRawScope()) - Assert(isa<MDScope>(S), "invalid scope for imported entity", &N, S); + Assert(isa<DIScope>(S), "invalid scope for imported entity", &N, S); Assert(isDIRef(N, N.getEntity()), "invalid imported entity", &N, N.getEntity()); } @@ -2904,7 +2904,7 @@ void Verifier::visitInstruction(Instruction &I) { } if (MDNode *N = I.getDebugLoc().getAsMDNode()) { - Assert(isa<MDLocation>(N), "invalid !dbg metadata attachment", &I, N); + Assert(isa<DILocation>(N), "invalid !dbg metadata attachment", &I, N); visitMDNode(*N); } @@ -3373,18 +3373,18 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { /// /// This carefully grabs the subprogram from a local scope, avoiding the /// built-in assertions that would typically fire. -static MDSubprogram *getSubprogram(Metadata *LocalScope) { +static DISubprogram *getSubprogram(Metadata *LocalScope) { if (!LocalScope) return nullptr; - if (auto *SP = dyn_cast<MDSubprogram>(LocalScope)) + if (auto *SP = dyn_cast<DISubprogram>(LocalScope)) return SP; - if (auto *LB = dyn_cast<MDLexicalBlockBase>(LocalScope)) + if (auto *LB = dyn_cast<DILexicalBlockBase>(LocalScope)) return getSubprogram(LB->getRawScope()); // Just return null; broken scope chains are checked elsewhere. - assert(!isa<MDLocalScope>(LocalScope) && "Unknown type of local scope"); + assert(!isa<DILocalScope>(LocalScope) && "Unknown type of local scope"); return nullptr; } @@ -3394,29 +3394,29 @@ void Verifier::visitDbgIntrinsic(StringRef Kind, DbgIntrinsicTy &DII) { Assert(isa<ValueAsMetadata>(MD) || (isa<MDNode>(MD) && !cast<MDNode>(MD)->getNumOperands()), "invalid llvm.dbg." + Kind + " intrinsic address/value", &DII, MD); - Assert(isa<MDLocalVariable>(DII.getRawVariable()), + Assert(isa<DILocalVariable>(DII.getRawVariable()), "invalid llvm.dbg." + Kind + " intrinsic variable", &DII, DII.getRawVariable()); - Assert(isa<MDExpression>(DII.getRawExpression()), + Assert(isa<DIExpression>(DII.getRawExpression()), "invalid llvm.dbg." + Kind + " intrinsic expression", &DII, DII.getRawExpression()); // Ignore broken !dbg attachments; they're checked elsewhere. if (MDNode *N = DII.getDebugLoc().getAsMDNode()) - if (!isa<MDLocation>(N)) + if (!isa<DILocation>(N)) return; BasicBlock *BB = DII.getParent(); Function *F = BB ? BB->getParent() : nullptr; // The scopes for variables and !dbg attachments must agree. - MDLocalVariable *Var = DII.getVariable(); - MDLocation *Loc = DII.getDebugLoc(); + DILocalVariable *Var = DII.getVariable(); + DILocation *Loc = DII.getDebugLoc(); Assert(Loc, "llvm.dbg." + Kind + " intrinsic requires a !dbg attachment", &DII, BB, F); - MDSubprogram *VarSP = getSubprogram(Var->getRawScope()); - MDSubprogram *LocSP = getSubprogram(Loc->getRawScope()); + DISubprogram *VarSP = getSubprogram(Var->getRawScope()); + DISubprogram *LocSP = getSubprogram(Loc->getRawScope()); if (!VarSP || !LocSP) return; // Broken scope chains are checked elsewhere. @@ -3427,16 +3427,16 @@ void Verifier::visitDbgIntrinsic(StringRef Kind, DbgIntrinsicTy &DII) { } template <class MapTy> -static uint64_t getVariableSize(const MDLocalVariable &V, const MapTy &Map) { +static uint64_t getVariableSize(const DILocalVariable &V, const MapTy &Map) { // Be careful of broken types (checked elsewhere). const Metadata *RawType = V.getRawType(); while (RawType) { // Try to get the size directly. - if (auto *T = dyn_cast<MDType>(RawType)) + if (auto *T = dyn_cast<DIType>(RawType)) if (uint64_t Size = T->getSizeInBits()) return Size; - if (auto *DT = dyn_cast<MDDerivedType>(RawType)) { + if (auto *DT = dyn_cast<DIDerivedType>(RawType)) { // Look at the base type. RawType = DT->getRawBaseType(); continue; @@ -3459,15 +3459,15 @@ static uint64_t getVariableSize(const MDLocalVariable &V, const MapTy &Map) { template <class MapTy> void Verifier::verifyBitPieceExpression(const DbgInfoIntrinsic &I, const MapTy &TypeRefs) { - MDLocalVariable *V; - MDExpression *E; + DILocalVariable *V; + DIExpression *E; if (auto *DVI = dyn_cast<DbgValueInst>(&I)) { - V = dyn_cast_or_null<MDLocalVariable>(DVI->getRawVariable()); - E = dyn_cast_or_null<MDExpression>(DVI->getRawExpression()); + V = dyn_cast_or_null<DILocalVariable>(DVI->getRawVariable()); + E = dyn_cast_or_null<DIExpression>(DVI->getRawExpression()); } else { auto *DDI = cast<DbgDeclareInst>(&I); - V = dyn_cast_or_null<MDLocalVariable>(DDI->getRawVariable()); - E = dyn_cast_or_null<MDExpression>(DDI->getRawExpression()); + V = dyn_cast_or_null<DILocalVariable>(DDI->getRawVariable()); + E = dyn_cast_or_null<DIExpression>(DDI->getRawExpression()); } // We don't know whether this intrinsic verified correctly. @@ -3503,11 +3503,11 @@ void Verifier::verifyTypeRefs() { return; // Visit all the compile units again to map the type references. - SmallDenseMap<const MDString *, const MDType *, 32> TypeRefs; + SmallDenseMap<const MDString *, const DIType *, 32> TypeRefs; for (auto *CU : CUs->operands()) - if (auto Ts = cast<MDCompileUnit>(CU)->getRetainedTypes()) - for (MDType *Op : Ts) - if (auto *T = dyn_cast<MDCompositeType>(Op)) + if (auto Ts = cast<DICompileUnit>(CU)->getRetainedTypes()) + for (DIType *Op : Ts) + if (auto *T = dyn_cast<DICompositeType>(Op)) if (auto *S = T->getRawIdentifier()) { UnresolvedTypeRefs.erase(S); TypeRefs.insert(std::make_pair(S, T)); diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 34a353a6c82..b0cf109bb00 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -1288,10 +1288,10 @@ void ModuleLinker::stripReplacedSubprograms() { if (!CompileUnits) return; for (unsigned I = 0, E = CompileUnits->getNumOperands(); I != E; ++I) { - auto *CU = cast<MDCompileUnit>(CompileUnits->getOperand(I)); + auto *CU = cast<DICompileUnit>(CompileUnits->getOperand(I)); assert(CU && "Expected valid compile unit"); - for (MDSubprogram *SP : CU->getSubprograms()) { + for (DISubprogram *SP : CU->getSubprograms()) { if (!SP || !SP->getFunction() || !Functions.count(SP->getFunction())) continue; diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp index 4db8f215699..80334229278 100644 --- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp +++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp @@ -348,7 +348,7 @@ void AArch64AsmPrinter::PrintDebugValueComment(const MachineInstr *MI, assert(NOps == 4); OS << '\t' << MAI->getCommentString() << "DEBUG_VALUE: "; // cast away const; DIetc do not take const operands for some reason. - OS << cast<MDLocalVariable>(MI->getOperand(NOps - 2).getMetadata()) + OS << cast<DILocalVariable>(MI->getOperand(NOps - 2).getMetadata()) ->getName(); OS << " <- "; // Frame address. Currently handles register +- offset only. diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index 85a4fa6c087..7c69bc57c02 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -129,7 +129,7 @@ void NVPTXAsmPrinter::emitLineNumberAsDotLoc(const MachineInstr &MI) { if (!curLoc) return; - auto *Scope = cast_or_null<MDScope>(curLoc.getScope()); + auto *Scope = cast_or_null<DIScope>(curLoc.getScope()); if (!Scope) return; @@ -773,7 +773,7 @@ void NVPTXAsmPrinter::recordAndEmitFilenames(Module &M) { DbgFinder.processModule(M); unsigned i = 1; - for (const MDCompileUnit *DIUnit : DbgFinder.compile_units()) { + for (const DICompileUnit *DIUnit : DbgFinder.compile_units()) { StringRef Filename = DIUnit->getFilename(); StringRef Dirname = DIUnit->getDirectory(); SmallString<128> FullPathName = Dirname; @@ -788,7 +788,7 @@ void NVPTXAsmPrinter::recordAndEmitFilenames(Module &M) { ++i; } - for (MDSubprogram *SP : DbgFinder.subprograms()) { + for (DISubprogram *SP : DbgFinder.subprograms()) { StringRef Filename = SP->getFilename(); StringRef Dirname = SP->getDirectory(); SmallString<128> FullPathName = Dirname; diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp index 79e15bd5e7e..7b7672d0edf 100644 --- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -90,7 +90,7 @@ namespace { bool doInitialization(CallGraph &CG) override; /// The maximum number of elements to expand, or 0 for unlimited. unsigned maxElements; - DenseMap<const Function *, MDSubprogram *> FunctionDIs; + DenseMap<const Function *, DISubprogram *> FunctionDIs; }; } @@ -706,7 +706,7 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F, // Patch the pointer to LLVM function in debug info descriptor. auto DI = FunctionDIs.find(F); if (DI != FunctionDIs.end()) { - MDSubprogram *SP = DI->second; + DISubprogram *SP = DI->second; SP->replaceFunction(NF); // Ensure the map is updated so it can be reused on subsequent argument // promotions of the same function. diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp index 83dab6d33da..546c8f3893a 100644 --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -127,7 +127,7 @@ namespace { // As the code generation for module is finished (and DIBuilder is // finalized) we assume that subprogram descriptors won't be changed, and // they are stored in map for short duration anyway. - DenseMap<const Function *, MDSubprogram *> FunctionDIs; + DenseMap<const Function *, DISubprogram *> FunctionDIs; protected: // DAH uses this to specify a different ID. @@ -303,7 +303,7 @@ bool DAE::DeleteDeadVarargs(Function &Fn) { // Patch the pointer to LLVM function in debug info descriptor. auto DI = FunctionDIs.find(&Fn); if (DI != FunctionDIs.end()) { - MDSubprogram *SP = DI->second; + DISubprogram *SP = DI->second; SP->replaceFunction(NF); // Ensure the map is updated so it can be reused on non-varargs argument // eliminations of the same function. diff --git a/llvm/lib/Transforms/IPO/StripSymbols.cpp b/llvm/lib/Transforms/IPO/StripSymbols.cpp index bcead02d80a..60c95734762 100644 --- a/llvm/lib/Transforms/IPO/StripSymbols.cpp +++ b/llvm/lib/Transforms/IPO/StripSymbols.cpp @@ -305,10 +305,10 @@ bool StripDeadDebugInfo::runOnModule(Module &M) { SmallVector<Metadata *, 64> LiveSubprograms; DenseSet<const MDNode *> VisitedSet; - for (MDCompileUnit *DIC : F.compile_units()) { + for (DICompileUnit *DIC : F.compile_units()) { // Create our live subprogram list. bool SubprogramChange = false; - for (MDSubprogram *DISP : DIC->getSubprograms()) { + for (DISubprogram *DISP : DIC->getSubprograms()) { // Make sure we visit each subprogram only once. if (!VisitedSet.insert(DISP).second) continue; @@ -322,7 +322,7 @@ bool StripDeadDebugInfo::runOnModule(Module &M) { // Create our live global variable list. bool GlobalVariableChange = false; - for (MDGlobalVariable *DIG : DIC->getGlobalVariables()) { + for (DIGlobalVariable *DIG : DIC->getGlobalVariables()) { // Make sure we only visit each global variable only once. if (!VisitedSet.insert(DIG).second) continue; diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 8d6d3ce3e61..1f2f30b9c96 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -250,8 +250,8 @@ struct LocationMetadata { void parse(MDNode *MDN) { assert(MDN->getNumOperands() == 3); - MDString *MDFilename = cast<MDString>(MDN->getOperand(0)); - Filename = MDFilename->getString(); + MDString *DIFilename = cast<MDString>(MDN->getOperand(0)); + Filename = DIFilename->getString(); LineNo = mdconst::extract<ConstantInt>(MDN->getOperand(1))->getLimitedValue(); ColumnNo = diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp index 53e5d9ddb43..1763c0fa804 100644 --- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -248,7 +248,7 @@ class DataFlowSanitizer : public ModulePass { DFSanABIList ABIList; DenseMap<Value *, Function *> UnwrappedFnMap; AttributeSet ReadOnlyNoneAttrs; - DenseMap<const Function *, MDSubprogram *> FunctionDIs; + DenseMap<const Function *, DISubprogram *> FunctionDIs; Value *getShadowAddress(Value *Addr, Instruction *Pos); bool isInstrumented(const Function *F); diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 292d869718e..231d421b26d 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -126,7 +126,7 @@ namespace { Function *insertFlush(ArrayRef<std::pair<GlobalVariable*, MDNode*> >); void insertIndirectCounterIncrement(); - std::string mangleName(const MDCompileUnit *CU, const char *NewStem); + std::string mangleName(const DICompileUnit *CU, const char *NewStem); GCOVOptions Options; @@ -149,7 +149,7 @@ ModulePass *llvm::createGCOVProfilerPass(const GCOVOptions &Options) { return new GCOVProfiler(Options); } -static StringRef getFunctionName(const MDSubprogram *SP) { +static StringRef getFunctionName(const DISubprogram *SP) { if (!SP->getLinkageName().empty()) return SP->getLinkageName(); return SP->getName(); @@ -309,7 +309,7 @@ namespace { // object users can construct, the blocks and lines will be rooted here. class GCOVFunction : public GCOVRecord { public: - GCOVFunction(const MDSubprogram *SP, raw_ostream *os, uint32_t Ident, + GCOVFunction(const DISubprogram *SP, raw_ostream *os, uint32_t Ident, bool UseCfgChecksum, bool ExitBlockBeforeBody) : SP(SP), Ident(Ident), UseCfgChecksum(UseCfgChecksum), CfgChecksum(0), ReturnBlock(1, os) { @@ -411,7 +411,7 @@ namespace { } private: - const MDSubprogram *SP; + const DISubprogram *SP; uint32_t Ident; uint32_t FuncChecksum; bool UseCfgChecksum; @@ -421,7 +421,7 @@ namespace { }; } -std::string GCOVProfiler::mangleName(const MDCompileUnit *CU, +std::string GCOVProfiler::mangleName(const DICompileUnit *CU, const char *NewStem) { if (NamedMDNode *GCov = M->getNamedMetadata("llvm.gcov")) { for (int i = 0, e = GCov->getNumOperands(); i != e; ++i) { @@ -488,7 +488,7 @@ void GCOVProfiler::emitProfileNotes() { // this pass over the original .o's as they're produced, or run it after // LTO, we'll generate the same .gcno files. - auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(i)); + auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i)); std::error_code EC; raw_fd_ostream out(mangleName(CU, "gcno"), EC, sys::fs::F_None); std::string EdgeDestinations; @@ -571,7 +571,7 @@ bool GCOVProfiler::emitProfileArcs() { bool Result = false; bool InsertIndCounterIncrCode = false; for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) { - auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(i)); + auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i)); SmallVector<std::pair<GlobalVariable *, MDNode *>, 8> CountersBySP; for (auto *SP : CU->getSubprograms()) { Function *F = SP->getFunction(); @@ -847,7 +847,7 @@ Function *GCOVProfiler::insertCounterWriteout( NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu"); if (CU_Nodes) { for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) { - auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(i)); + auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i)); std::string FilenameGcda = mangleName(CU, "gcda"); uint32_t CfgChecksum = FileChecksums.empty() ? 0 : FileChecksums[i]; Builder.CreateCall3(StartFile, @@ -855,7 +855,7 @@ Function *GCOVProfiler::insertCounterWriteout( Builder.CreateGlobalStringPtr(ReversedVersion), Builder.getInt32(CfgChecksum)); for (unsigned j = 0, e = CountersBySP.size(); j != e; ++j) { - auto *SP = cast_or_null<MDSubprogram>(CountersBySP[j].second); + auto *SP = cast_or_null<DISubprogram>(CountersBySP[j].second); uint32_t FuncChecksum = Funcs.empty() ? 0 : Funcs[j]->getFuncChecksum(); Builder.CreateCall5( EmitFunction, Builder.getInt32(j), diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 66aed8dbf88..3e062ba96d7 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -1096,8 +1096,8 @@ public: // Retain the debug information attached to the alloca for use when // rewriting loads and stores. if (auto *L = LocalAsMetadata::getIfExists(&AI)) { - if (auto *DebugNode = MetadataAsValue::getIfExists(AI.getContext(), L)) { - for (User *U : DebugNode->users()) + if (auto *DINode = MetadataAsValue::getIfExists(AI.getContext(), L)) { + for (User *U : DINode->users()) if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(U)) DDIs.push_back(DDI); else if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(U)) diff --git a/llvm/lib/Transforms/Scalar/SampleProfile.cpp b/llvm/lib/Transforms/Scalar/SampleProfile.cpp index f4936b57062..594a7beb2e3 100644 --- a/llvm/lib/Transforms/Scalar/SampleProfile.cpp +++ b/llvm/lib/Transforms/Scalar/SampleProfile.cpp @@ -224,7 +224,7 @@ unsigned SampleProfileLoader::getInstWeight(Instruction &Inst) { if (Lineno < HeaderLineno) return 0; - const MDLocation *DIL = DLoc; + const DILocation *DIL = DLoc; int LOffset = Lineno - HeaderLineno; unsigned Discriminator = DIL->getDiscriminator(); unsigned Weight = Samples->samplesAt(LOffset, Discriminator); @@ -642,7 +642,7 @@ void SampleProfileLoader::propagateWeights(Function &F) { /// \returns the line number where \p F is defined. If it returns 0, /// it means that there is no debug information available for \p F. unsigned SampleProfileLoader::getFunctionLoc(Function &F) { - if (MDSubprogram *S = getDISubprogram(&F)) + if (DISubprogram *S = getDISubprogram(&F)) return S->getLine(); // If could not find the start of \p F, emit a diagnostic to inform the user diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 5b47ef9d730..2ec1fd014aa 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -1060,8 +1060,8 @@ public: // Remember which alloca we're promoting (for isInstInList). this->AI = AI; if (auto *L = LocalAsMetadata::getIfExists(AI)) { - if (auto *DebugNode = MetadataAsValue::getIfExists(AI->getContext(), L)) { - for (User *U : DebugNode->users()) + if (auto *DINode = MetadataAsValue::getIfExists(AI->getContext(), L)) { + for (User *U : DINode->users()) if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(U)) DDIs.push_back(DDI); else if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(U)) diff --git a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp index 125aab2fe88..e9f62391a44 100644 --- a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp +++ b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp @@ -174,14 +174,14 @@ bool AddDiscriminators::runOnFunction(Function &F) { for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { BasicBlock *B = I; TerminatorInst *Last = B->getTerminator(); - const MDLocation *LastDIL = Last->getDebugLoc(); + const DILocation *LastDIL = Last->getDebugLoc(); if (!LastDIL) continue; for (unsigned I = 0; I < Last->getNumSuccessors(); ++I) { BasicBlock *Succ = Last->getSuccessor(I); Instruction *First = Succ->getFirstNonPHIOrDbgOrLifetime(); - const MDLocation *FirstDIL = First->getDebugLoc(); + const DILocation *FirstDIL = First->getDebugLoc(); if (!FirstDIL) continue; @@ -197,7 +197,7 @@ bool AddDiscriminators::runOnFunction(Function &F) { auto *File = Builder.createFile(Filename, Scope->getDirectory()); // FIXME: Calculate the discriminator here, based on local information, - // and delete MDLocation::computeNewDiscriminator(). The current + // and delete DILocation::computeNewDiscriminator(). The current // solution gives different results depending on other modules in the // same context. All we really need is to discriminate between // FirstDIL and LastDIL -- a local map would suffice. @@ -205,7 +205,7 @@ bool AddDiscriminators::runOnFunction(Function &F) { auto *NewScope = Builder.createLexicalBlockFile(Scope, File, Discriminator); auto *NewDIL = - MDLocation::get(Ctx, FirstDIL->getLine(), FirstDIL->getColumn(), + DILocation::get(Ctx, FirstDIL->getLine(), FirstDIL->getColumn(), NewScope, FirstDIL->getInlinedAt()); DebugLoc newDebugLoc = NewDIL; diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index a9f476a669e..4f8d1dfbe5d 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -155,9 +155,9 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc, } // Find the MDNode which corresponds to the subprogram data that described F. -static MDSubprogram *FindSubprogram(const Function *F, +static DISubprogram *FindSubprogram(const Function *F, DebugInfoFinder &Finder) { - for (MDSubprogram *Subprogram : Finder.subprograms()) { + for (DISubprogram *Subprogram : Finder.subprograms()) { if (Subprogram->describes(F)) return Subprogram; } @@ -166,7 +166,7 @@ static MDSubprogram *FindSubprogram(const Function *F, // Add an operand to an existing MDNode. The new operand will be added at the // back of the operand list. -static void AddOperand(MDCompileUnit *CU, MDSubprogramArray SPs, +static void AddOperand(DICompileUnit *CU, DISubprogramArray SPs, Metadata *NewSP) { SmallVector<Metadata *, 16> NewSPs; NewSPs.reserve(SPs.size() + 1); @@ -183,14 +183,14 @@ static void CloneDebugInfoMetadata(Function *NewFunc, const Function *OldFunc, DebugInfoFinder Finder; Finder.processModule(*OldFunc->getParent()); - const MDSubprogram *OldSubprogramMDNode = FindSubprogram(OldFunc, Finder); + const DISubprogram *OldSubprogramMDNode = FindSubprogram(OldFunc, Finder); if (!OldSubprogramMDNode) return; // Ensure that OldFunc appears in the map. // (if it's already there it must point to NewFunc anyway) VMap[OldFunc] = NewFunc; auto *NewSubprogram = - cast<MDSubprogram>(MapMetadata(OldSubprogramMDNode, VMap)); + cast<DISubprogram>(MapMetadata(OldSubprogramMDNode, VMap)); for (auto *CU : Finder.compile_units()) { auto Subprograms = CU->getSubprograms(); diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 169ebcf5bfc..97bfae1003e 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -830,17 +830,16 @@ static bool hasLifetimeMarkers(AllocaInst *AI) { /// Rebuild the entire inlined-at chain for this instruction so that the top of /// the chain now is inlined-at the new call site. static DebugLoc -updateInlinedAtInfo(DebugLoc DL, MDLocation *InlinedAtNode, - LLVMContext &Ctx, - DenseMap<const MDLocation *, MDLocation *> &IANodes) { - SmallVector<MDLocation*, 3> InlinedAtLocations; - MDLocation *Last = InlinedAtNode; - MDLocation *CurInlinedAt = DL; +updateInlinedAtInfo(DebugLoc DL, DILocation *InlinedAtNode, LLVMContext &Ctx, + DenseMap<const DILocation *, DILocation *> &IANodes) { + SmallVector<DILocation *, 3> InlinedAtLocations; + DILocation *Last = InlinedAtNode; + DILocation *CurInlinedAt = DL; // Gather all the inlined-at nodes - while (MDLocation *IA = CurInlinedAt->getInlinedAt()) { + while (DILocation *IA = CurInlinedAt->getInlinedAt()) { // Skip any we've already built nodes for - if (MDLocation *Found = IANodes[IA]) { + if (DILocation *Found = IANodes[IA]) { Last = Found; break; } @@ -854,8 +853,8 @@ updateInlinedAtInfo(DebugLoc DL, MDLocation *InlinedAtNode, // map of already-constructed inlined-at nodes. for (auto I = InlinedAtLocations.rbegin(), E = InlinedAtLocations.rend(); I != E; ++I) { - const MDLocation *MD = *I; - Last = IANodes[MD] = MDLocation::getDistinct( + const DILocation *MD = *I; + Last = IANodes[MD] = DILocation::getDistinct( Ctx, MD->getLine(), MD->getColumn(), MD->getScope(), Last); } @@ -873,18 +872,18 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI, return; auto &Ctx = Fn->getContext(); - MDLocation *InlinedAtNode = TheCallDL; + DILocation *InlinedAtNode = TheCallDL; // Create a unique call site, not to be confused with any other call from the // same location. - InlinedAtNode = MDLocation::getDistinct( + InlinedAtNode = DILocation::getDistinct( Ctx, InlinedAtNode->getLine(), InlinedAtNode->getColumn(), InlinedAtNode->getScope(), InlinedAtNode->getInlinedAt()); // Cache the inlined-at nodes as they're built so they are reused, without // this every instruction's inlined-at chain would become distinct from each // other. - DenseMap<const MDLocation *, MDLocation *> IANodes; + DenseMap<const DILocation *, DILocation *> IANodes; for (; FI != Fn->end(); ++FI) { for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 492dc07d1eb..4d40ba842a0 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -978,7 +978,7 @@ unsigned llvm::getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign, /// /// See if there is a dbg.value intrinsic for DIVar before I. -static bool LdStHasDebugValue(const MDLocalVariable *DIVar, Instruction *I) { +static bool LdStHasDebugValue(const DILocalVariable *DIVar, Instruction *I) { // Since we can't guarantee that the original dbg.declare instrinsic // is removed by LowerDbgDeclare(), we need to make sure that we are // not inserting the same dbg.value intrinsic over and over. |