mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
AsmWriter: MDSubprogram: Recognize DW_VIRTUALITY in 'virtuality'
llvm-svn: 229015
This commit is contained in:
parent
52584d6996
commit
9c2655de4a
@ -746,6 +746,7 @@ lltok::Kind LLLexer::LexIdentifier() {
|
|||||||
}
|
}
|
||||||
DWKEYWORD(TAG, DwarfTag);
|
DWKEYWORD(TAG, DwarfTag);
|
||||||
DWKEYWORD(ATE, DwarfAttEncoding);
|
DWKEYWORD(ATE, DwarfAttEncoding);
|
||||||
|
DWKEYWORD(VIRTUALITY, DwarfVirtuality);
|
||||||
DWKEYWORD(LANG, DwarfLang);
|
DWKEYWORD(LANG, DwarfLang);
|
||||||
#undef DWKEYWORD
|
#undef DWKEYWORD
|
||||||
|
|
||||||
|
@ -2949,6 +2949,9 @@ struct DwarfTagField : public MDUnsignedField {
|
|||||||
struct DwarfAttEncodingField : public MDUnsignedField {
|
struct DwarfAttEncodingField : public MDUnsignedField {
|
||||||
DwarfAttEncodingField() : MDUnsignedField(0, dwarf::DW_ATE_hi_user) {}
|
DwarfAttEncodingField() : MDUnsignedField(0, dwarf::DW_ATE_hi_user) {}
|
||||||
};
|
};
|
||||||
|
struct DwarfVirtualityField : public MDUnsignedField {
|
||||||
|
DwarfVirtualityField() : MDUnsignedField(0, dwarf::DW_VIRTUALITY_max) {}
|
||||||
|
};
|
||||||
struct DwarfLangField : public MDUnsignedField {
|
struct DwarfLangField : public MDUnsignedField {
|
||||||
DwarfLangField() : MDUnsignedField(0, dwarf::DW_LANG_hi_user) {}
|
DwarfLangField() : MDUnsignedField(0, dwarf::DW_LANG_hi_user) {}
|
||||||
};
|
};
|
||||||
@ -3026,6 +3029,25 @@ bool LLParser::ParseMDField(LocTy Loc, StringRef Name, DwarfTagField &Result) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
bool LLParser::ParseMDField(LocTy Loc, StringRef Name,
|
||||||
|
DwarfVirtualityField &Result) {
|
||||||
|
if (Lex.getKind() == lltok::APSInt)
|
||||||
|
return ParseMDField(Loc, Name, static_cast<MDUnsignedField &>(Result));
|
||||||
|
|
||||||
|
if (Lex.getKind() != lltok::DwarfVirtuality)
|
||||||
|
return TokError("expected DWARF virtuality code");
|
||||||
|
|
||||||
|
unsigned Virtuality = dwarf::getVirtuality(Lex.getStrVal());
|
||||||
|
if (!Virtuality)
|
||||||
|
return TokError("invalid DWARF virtuality code" + Twine(" '") +
|
||||||
|
Lex.getStrVal() + "'");
|
||||||
|
assert(Virtuality <= Result.Max && "Expected valid DWARF virtuality code");
|
||||||
|
Result.assign(Virtuality);
|
||||||
|
Lex.Lex();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool LLParser::ParseMDField(LocTy Loc, StringRef Name, DwarfLangField &Result) {
|
bool LLParser::ParseMDField(LocTy Loc, StringRef Name, DwarfLangField &Result) {
|
||||||
if (Lex.getKind() == lltok::APSInt)
|
if (Lex.getKind() == lltok::APSInt)
|
||||||
@ -3408,7 +3430,8 @@ bool LLParser::ParseMDCompileUnit(MDNode *&Result, bool IsDistinct) {
|
|||||||
/// ::= !MDSubprogram(scope: !0, name: "foo", linkageName: "_Zfoo",
|
/// ::= !MDSubprogram(scope: !0, name: "foo", linkageName: "_Zfoo",
|
||||||
/// file: !1, line: 7, type: !2, isLocal: false,
|
/// file: !1, line: 7, type: !2, isLocal: false,
|
||||||
/// isDefinition: true, scopeLine: 8, containingType: !3,
|
/// isDefinition: true, scopeLine: 8, containingType: !3,
|
||||||
/// virtuality: 2, virtualIndex: 10, flags: 11,
|
/// virtuality: DW_VIRTUALTIY_pure_virtual,
|
||||||
|
/// virtualIndex: 10, flags: 11,
|
||||||
/// isOptimized: false, function: void ()* @_Z3foov,
|
/// isOptimized: false, function: void ()* @_Z3foov,
|
||||||
/// templateParams: !4, declaration: !5, variables: !6)
|
/// templateParams: !4, declaration: !5, variables: !6)
|
||||||
bool LLParser::ParseMDSubprogram(MDNode *&Result, bool IsDistinct) {
|
bool LLParser::ParseMDSubprogram(MDNode *&Result, bool IsDistinct) {
|
||||||
@ -3423,7 +3446,7 @@ bool LLParser::ParseMDSubprogram(MDNode *&Result, bool IsDistinct) {
|
|||||||
OPTIONAL(isDefinition, MDBoolField, (true)); \
|
OPTIONAL(isDefinition, MDBoolField, (true)); \
|
||||||
OPTIONAL(scopeLine, LineField, ); \
|
OPTIONAL(scopeLine, LineField, ); \
|
||||||
OPTIONAL(containingType, MDField, ); \
|
OPTIONAL(containingType, MDField, ); \
|
||||||
OPTIONAL(virtuality, MDUnsignedField, (0, dwarf::DW_VIRTUALITY_max)); \
|
OPTIONAL(virtuality, DwarfVirtualityField, ); \
|
||||||
OPTIONAL(virtualIndex, MDUnsignedField, (0, UINT32_MAX)); \
|
OPTIONAL(virtualIndex, MDUnsignedField, (0, UINT32_MAX)); \
|
||||||
OPTIONAL(flags, MDUnsignedField, (0, UINT32_MAX)); \
|
OPTIONAL(flags, MDUnsignedField, (0, UINT32_MAX)); \
|
||||||
OPTIONAL(isOptimized, MDBoolField, ); \
|
OPTIONAL(isOptimized, MDBoolField, ); \
|
||||||
|
@ -200,6 +200,7 @@ namespace lltok {
|
|||||||
StringConstant, // "foo"
|
StringConstant, // "foo"
|
||||||
DwarfTag, // DW_TAG_foo (includes "DW_TAG_")
|
DwarfTag, // DW_TAG_foo (includes "DW_TAG_")
|
||||||
DwarfAttEncoding, // DW_ATE_foo (includes "DW_ATE_")
|
DwarfAttEncoding, // DW_ATE_foo (includes "DW_ATE_")
|
||||||
|
DwarfVirtuality, // DW_VIRTUALITY_foo (includes "DW_VIRTUALITY_")
|
||||||
DwarfLang, // DW_LANG_foo (includes "DW_LANG_")
|
DwarfLang, // DW_LANG_foo (includes "DW_LANG_")
|
||||||
|
|
||||||
// Type valued tokens (TyVal).
|
// Type valued tokens (TyVal).
|
||||||
|
@ -1588,8 +1588,13 @@ static void writeMDSubprogram(raw_ostream &Out, const MDSubprogram *N,
|
|||||||
writeMetadataAsOperand(Out, N->getContainingType(), TypePrinter, Machine,
|
writeMetadataAsOperand(Out, N->getContainingType(), TypePrinter, Machine,
|
||||||
Context);
|
Context);
|
||||||
}
|
}
|
||||||
if (N->getVirtuality())
|
if (unsigned V = N->getVirtuality()) {
|
||||||
Out << FS << "virtuality: " << N->getVirtuality();
|
Out << FS << "virtuality: ";
|
||||||
|
if (const char *S = dwarf::VirtualityString(V))
|
||||||
|
Out << S;
|
||||||
|
else
|
||||||
|
Out << V;
|
||||||
|
}
|
||||||
if (N->getVirtualIndex())
|
if (N->getVirtualIndex())
|
||||||
Out << FS << "virtualIndex: " << N->getVirtualIndex();
|
Out << FS << "virtualIndex: " << N->getVirtualIndex();
|
||||||
if (N->getFlags())
|
if (N->getFlags())
|
||||||
|
@ -15,12 +15,12 @@ declare void @_Z3foov()
|
|||||||
!6 = distinct !{}
|
!6 = distinct !{}
|
||||||
!7 = distinct !{}
|
!7 = distinct !{}
|
||||||
|
|
||||||
; CHECK: !8 = !MDSubprogram(scope: !0, name: "foo", linkageName: "_Zfoov", file: !2, line: 7, type: !3, isLocal: true, isDefinition: false, scopeLine: 8, containingType: !4, virtuality: 2, virtualIndex: 10, flags: 11, isOptimized: true, function: void ()* @_Z3foov, templateParams: !5, declaration: !6, variables: !7)
|
; CHECK: !8 = !MDSubprogram(scope: !0, name: "foo", linkageName: "_Zfoov", file: !2, line: 7, type: !3, isLocal: true, isDefinition: false, scopeLine: 8, containingType: !4, virtuality: DW_VIRTUALITY_pure_virtual, virtualIndex: 10, flags: 11, isOptimized: true, function: void ()* @_Z3foov, templateParams: !5, declaration: !6, variables: !7)
|
||||||
!8 = !MDSubprogram(scope: !0, name: "foo", linkageName: "_Zfoov",
|
!8 = !MDSubprogram(scope: !0, name: "foo", linkageName: "_Zfoov",
|
||||||
file: !2, line: 7, type: !3, isLocal: true,
|
file: !2, line: 7, type: !3, isLocal: true,
|
||||||
isDefinition: false, scopeLine: 8, containingType: !4,
|
isDefinition: false, scopeLine: 8, containingType: !4,
|
||||||
virtuality: 2, virtualIndex: 10, flags: 11,
|
virtuality: DW_VIRTUALITY_pure_virtual, virtualIndex: 10,
|
||||||
isOptimized: true, function: void ()* @_Z3foov,
|
flags: 11, isOptimized: true, function: void ()* @_Z3foov,
|
||||||
templateParams: !5, declaration: !6, variables: !7)
|
templateParams: !5, declaration: !6, variables: !7)
|
||||||
|
|
||||||
; CHECK: !9 = !MDSubprogram(scope: null, name: "bar", isLocal: false, isDefinition: true, isOptimized: false)
|
; CHECK: !9 = !MDSubprogram(scope: null, name: "bar", isLocal: false, isDefinition: true, isOptimized: false)
|
||||||
|
@ -80,6 +80,7 @@ syn match llvmType /!\zs\a\+\ze\s*(/
|
|||||||
syn match llvmConstant /\<DW_TAG_[a-z_]\+\>/
|
syn match llvmConstant /\<DW_TAG_[a-z_]\+\>/
|
||||||
syn match llvmConstant /\<DW_ATE_[a-zA-Z_]\+\>/
|
syn match llvmConstant /\<DW_ATE_[a-zA-Z_]\+\>/
|
||||||
syn match llvmConstant /\<DW_LANG_[a-zA-Z0-9_]\+\>/
|
syn match llvmConstant /\<DW_LANG_[a-zA-Z0-9_]\+\>/
|
||||||
|
syn match llvmConstant /\<DW_VIRTUALITY_[a-z_]\+\>/
|
||||||
|
|
||||||
" Syntax-highlight dejagnu test commands.
|
" Syntax-highlight dejagnu test commands.
|
||||||
syn match llvmSpecialComment /;\s*RUN:.*$/
|
syn match llvmSpecialComment /;\s*RUN:.*$/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user