Add support for DW_TAG_thrown_type.
For Swift we would like to be able to encode the error types that a function may throw, so the debugger can display them alongside the function's return value when finish-ing a function. DWARF defines DW_TAG_thrown_type (intended to be used for C++ throw() declarations) that is a perfect fit for this purpose. This patch wires up support for DW_TAG_thrown_type in LLVM by adding a list of thrown types to DISubprogram. To offset the cost of the extra pointer, there is a follow-up patch that turns DISubprogram into a variable-length node. rdar://problem/29481673 Differential Revision: https://reviews.llvm.org/D32559 llvm-svn: 301489
This commit is contained in:
@@ -1298,7 +1298,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
|
||||
break;
|
||||
}
|
||||
case bitc::METADATA_SUBPROGRAM: {
|
||||
if (Record.size() < 18 || Record.size() > 20)
|
||||
if (Record.size() < 18 || Record.size() > 21)
|
||||
return error("Invalid record");
|
||||
|
||||
IsDistinct =
|
||||
@@ -1314,29 +1314,31 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
|
||||
unsigned Offset = Record.size() >= 19 ? 1 : 0;
|
||||
bool HasFn = Offset && !HasUnit;
|
||||
bool HasThisAdj = Record.size() >= 20;
|
||||
bool HasThrownTypes = Record.size() >= 21;
|
||||
DISubprogram *SP = GET_OR_DISTINCT(
|
||||
DISubprogram, (Context,
|
||||
getDITypeRefOrNull(Record[1]), // scope
|
||||
getMDString(Record[2]), // name
|
||||
getMDString(Record[3]), // linkageName
|
||||
getMDOrNull(Record[4]), // file
|
||||
Record[5], // line
|
||||
getMDOrNull(Record[6]), // type
|
||||
Record[7], // isLocal
|
||||
Record[8], // isDefinition
|
||||
Record[9], // scopeLine
|
||||
getDITypeRefOrNull(Record[10]), // containingType
|
||||
Record[11], // virtuality
|
||||
Record[12], // virtualIndex
|
||||
HasThisAdj ? Record[19] : 0, // thisAdjustment
|
||||
static_cast<DINode::DIFlags>(Record[13] // flags
|
||||
),
|
||||
Record[14], // isOptimized
|
||||
HasUnit ? CUorFn : nullptr, // unit
|
||||
getMDOrNull(Record[15 + Offset]), // templateParams
|
||||
getMDOrNull(Record[16 + Offset]), // declaration
|
||||
getMDOrNull(Record[17 + Offset]) // variables
|
||||
));
|
||||
DISubprogram,
|
||||
(Context,
|
||||
getDITypeRefOrNull(Record[1]), // scope
|
||||
getMDString(Record[2]), // name
|
||||
getMDString(Record[3]), // linkageName
|
||||
getMDOrNull(Record[4]), // file
|
||||
Record[5], // line
|
||||
getMDOrNull(Record[6]), // type
|
||||
Record[7], // isLocal
|
||||
Record[8], // isDefinition
|
||||
Record[9], // scopeLine
|
||||
getDITypeRefOrNull(Record[10]), // containingType
|
||||
Record[11], // virtuality
|
||||
Record[12], // virtualIndex
|
||||
HasThisAdj ? Record[19] : 0, // thisAdjustment
|
||||
static_cast<DINode::DIFlags>(Record[13]), // flags
|
||||
Record[14], // isOptimized
|
||||
HasUnit ? CUorFn : nullptr, // unit
|
||||
getMDOrNull(Record[15 + Offset]), // templateParams
|
||||
getMDOrNull(Record[16 + Offset]), // declaration
|
||||
getMDOrNull(Record[17 + Offset]), // variables
|
||||
HasThrownTypes ? getMDOrNull(Record[20]) : nullptr // thrownTypes
|
||||
));
|
||||
MetadataList.assignValue(SP, NextMetadataNo);
|
||||
NextMetadataNo++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user