mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
Solidify the assumption that a DW_TAG_subprogram's type is a DW_TAG_subroutine_type
There were bits & pieces of code lying around that may've given the impression that debug info metadata supported the possibility that a subprogram's type could be specified by a non-subroutine type describing the return type of a void function. This support was incomplete & unnecessary. Asserts & API have been changed to make the desired usage more clear. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182532 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1208,13 +1208,11 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
|
||||
|
||||
// Add Return Type.
|
||||
DICompositeType SPTy = SP.getType();
|
||||
DIArray Args = SPTy.getTypeArray();
|
||||
unsigned SPTag = SPTy.getTag();
|
||||
assert(SPTy.getTag() == dwarf::DW_TAG_subroutine_type &&
|
||||
"the type of a subprogram should be a subroutine");
|
||||
|
||||
if (Args.getNumElements() == 0 || SPTag != dwarf::DW_TAG_subroutine_type)
|
||||
addType(SPDie, SPTy);
|
||||
else
|
||||
addType(SPDie, DIType(Args.getElement(0)));
|
||||
DIArray Args = SPTy.getTypeArray();
|
||||
addType(SPDie, DIType(Args.getElement(0)));
|
||||
|
||||
unsigned VK = SP.getVirtuality();
|
||||
if (VK) {
|
||||
@ -1232,19 +1230,14 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
|
||||
|
||||
// Add arguments. Do not add arguments for subprogram definition. They will
|
||||
// be handled while processing variables.
|
||||
DICompositeType SPTy = SP.getType();
|
||||
DIArray Args = SPTy.getTypeArray();
|
||||
unsigned SPTag = SPTy.getTag();
|
||||
|
||||
if (SPTag == dwarf::DW_TAG_subroutine_type)
|
||||
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
|
||||
DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
|
||||
DIType ATy = DIType(Args.getElement(i));
|
||||
addType(Arg, ATy);
|
||||
if (ATy.isArtificial())
|
||||
addFlag(Arg, dwarf::DW_AT_artificial);
|
||||
SPDie->addChild(Arg);
|
||||
}
|
||||
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
|
||||
DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
|
||||
DIType ATy = DIType(Args.getElement(i));
|
||||
addType(Arg, ATy);
|
||||
if (ATy.isArtificial())
|
||||
addFlag(Arg, dwarf::DW_AT_artificial);
|
||||
SPDie->addChild(Arg);
|
||||
}
|
||||
}
|
||||
|
||||
if (SP.isArtificial())
|
||||
|
Reference in New Issue
Block a user