Emit debug info for the compiler-generated field type accessors.

Failing to do so will lead to hard-to-debug verifier errors in LLVM
when these functions get inlined.
This commit is contained in:
Adrian Prantl
2016-02-04 10:09:08 -08:00
parent 544f36a360
commit 88faa3b690
2 changed files with 4 additions and 14 deletions

View File

@@ -2158,7 +2158,7 @@ namespace {
+ type->getName().str(),
IGM.getModule());
fn->setAttributes(IGM.constructInitialAttributes());
// Emit the body of the field type accessor later. We need to access
// the type metadata for the fields, which could lead to infinite recursion
// in recursive types if we build the field type accessor during metadata
@@ -2466,6 +2466,9 @@ irgen::emitFieldTypeAccessor(IRGenModule &IGM,
ArrayRef<FieldTypeInfo> fieldTypes)
{
IRGenFunction IGF(IGM, fn);
if (IGM.DebugInfo)
IGM.DebugInfo->emitArtificialFunction(IGF, fn);
auto metadataArrayPtrTy = IGM.TypeMetadataPtrTy->getPointerTo();
CanType formalType = type->getDeclaredTypeInContext()->getCanonicalType();