Add support for function types.
llvm-svn: 28874
diff --git a/llvm/lib/CodeGen/DwarfWriter.cpp b/llvm/lib/CodeGen/DwarfWriter.cpp
index 3ca9686..f77871e 100644
--- a/llvm/lib/CodeGen/DwarfWriter.cpp
+++ b/llvm/lib/CodeGen/DwarfWriter.cpp
@@ -1402,6 +1402,23 @@
break;
}
+ case DW_TAG_subroutine_type: {
+ // Add prototype flag.
+ Ty->AddUInt(DW_AT_prototyped, DW_FORM_flag, 1);
+ // Add return type.
+ Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4,
+ NewType(Context, cast<TypeDesc>(Elements[0]), Unit));
+
+ // Add arguments.
+ for(unsigned i = 1, N = Elements.size(); i < N; ++i) {
+ DIE *Arg = new DIE(DW_TAG_formal_parameter);
+ Arg->AddDIEntry(DW_AT_type, DW_FORM_ref4,
+ NewType(Context, cast<TypeDesc>(Elements[i]), Unit));
+ Ty->AddChild(Arg);
+ }
+
+ break;
+ }
default: break;
}
}