summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineDebugInfo.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-03-01 23:52:37 +0000
committerJim Laskey <jlaskey@mac.com>2006-03-01 23:52:37 +0000
commit862001ad75bbec5153973f1868ff64f1dc8daba4 (patch)
tree6f4aa08841ffcc199a9de6047a4cd37a46a7b75a /llvm/lib/CodeGen/MachineDebugInfo.cpp
parentc652c30772cc28263856b9836d1f5f1159d24b6b (diff)
downloadbcm5719-llvm-862001ad75bbec5153973f1868ff64f1dc8daba4.tar.gz
bcm5719-llvm-862001ad75bbec5153973f1868ff64f1dc8daba4.zip
Support for enumerations.
llvm-svn: 26466
Diffstat (limited to 'llvm/lib/CodeGen/MachineDebugInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineDebugInfo.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineDebugInfo.cpp b/llvm/lib/CodeGen/MachineDebugInfo.cpp
index 46163a777e6..c5309417055 100644
--- a/llvm/lib/CodeGen/MachineDebugInfo.cpp
+++ b/llvm/lib/CodeGen/MachineDebugInfo.cpp
@@ -516,6 +516,7 @@ DebugInfoDesc *DebugInfoDesc::DescFactory(unsigned Tag) {
case DW_TAG_union_type:
case DW_TAG_enumeration_type: return new CompositeTypeDesc(Tag);
case DW_TAG_subrange_type: return new SubrangeDesc();
+ case DW_TAG_enumerator: return new EnumeratorDesc();
default: break;
}
return NULL;
@@ -909,6 +910,49 @@ void SubrangeDesc::dump() {
//===----------------------------------------------------------------------===//
+EnumeratorDesc::EnumeratorDesc()
+: DebugInfoDesc(DW_TAG_enumerator)
+, Name("")
+, Value(0)
+{}
+
+// Implement isa/cast/dyncast.
+bool EnumeratorDesc::classof(const DebugInfoDesc *D) {
+ return D->getTag() == DW_TAG_enumerator;
+}
+
+/// ApplyToFields - Target the visitor to the fields of the EnumeratorDesc.
+///
+void EnumeratorDesc::ApplyToFields(DIVisitor *Visitor) {
+ DebugInfoDesc::ApplyToFields(Visitor);
+
+ Visitor->Apply(Name);
+ Visitor->Apply(Value);
+}
+
+/// getDescString - Return a string used to compose global names and labels.
+///
+const char *EnumeratorDesc::getDescString() const {
+ return "llvm.dbg.enumerator";
+}
+
+/// getTypeString - Return a string used to label this descriptor's type.
+///
+const char *EnumeratorDesc::getTypeString() const {
+ return "llvm.dbg.enumerator.type";
+}
+
+#ifndef NDEBUG
+void EnumeratorDesc::dump() {
+ std::cerr << getDescString() << " "
+ << "Tag(" << getTag() << "), "
+ << "Name(" << Name << "), "
+ << "Value(" << Value << ")\n";
+}
+#endif
+
+//===----------------------------------------------------------------------===//
+
GlobalDesc::GlobalDesc(unsigned T)
: AnchoredDesc(T)
, Context(0)
OpenPOWER on IntegriCloud