[llvm-commits] CVS: llvm/lib/CodeGen/MachineDebugInfo.cpp

Jim Laskey jlaskey at apple.com
Tue Mar 14 10:38:09 PST 2006



Changes in directory llvm/lib/CodeGen:

MachineDebugInfo.cpp updated: 1.30 -> 1.31
---
Log message:

1. Use null for serialized empty strings.
2. Allow for user defined debug descriptors.
3. Allow for user augmented fields on debug descriptors.


---
Diffs of the changes:  (+17 -9)

 MachineDebugInfo.cpp |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.30 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.31
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.30	Thu Mar  9 11:48:46 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp	Tue Mar 14 12:37:57 2006
@@ -270,7 +270,11 @@
     Elements.push_back(ConstantBool::get(Field));
   }
   virtual void Apply(std::string &Field) {
-    Elements.push_back(SR.getString(Field));
+    if (Field.empty()) {
+      Elements.push_back(NULL);
+    } else {
+      Elements.push_back(SR.getString(Field));
+    }
   }
   virtual void Apply(DebugInfoDesc *&Field) {
     GlobalVariable *GV = NULL;
@@ -417,7 +421,7 @@
   }
   virtual void Apply(std::string &Field) {
     Constant *C = CI->getOperand(I++);
-    IsValid = IsValid && isStringValue(C);
+    IsValid = IsValid && (!C || isStringValue(C));
   }
   virtual void Apply(DebugInfoDesc *&Field) {
     // FIXME - Prepare the correct descriptor.
@@ -1086,11 +1090,13 @@
   
   // Create an empty instance of the correct sort.
   Slot = DebugInfoDesc::DescFactory(Tag);
-  assert(Slot && "Unknown Tag");
   
-  // Deserialize the fields.
-  DIDeserializeVisitor DRAM(*this, GV);
-  DRAM.ApplyToFields(Slot);
+  // If not a user defined descriptor.
+  if (Slot) {
+    // Deserialize the fields.
+    DIDeserializeVisitor DRAM(*this, GV);
+    DRAM.ApplyToFields(Slot);
+  }
   
   return Slot;
 }
@@ -1238,7 +1244,9 @@
 
   // Construct an empty DebugInfoDesc.
   DebugInfoDesc *DD = DebugInfoDesc::DescFactory(Tag);
-  if (!DD) return false;
+  
+  // Allow for user defined descriptors.
+  if (!DD) return true;
   
   // Get the initializer constant.
   ConstantStruct *CI = cast<ConstantStruct>(GV->getInitializer());
@@ -1255,8 +1263,8 @@
     Slot = CTAM.getCount();
   }
   
-  // Field count must equal operand count.
-  if (Slot != N) {
+  // Field count must be at most equal operand count.
+  if (Slot >  N) {
     delete DD;
     return false;
   }






More information about the llvm-commits mailing list