[PATCH] Add DWARFFormValue::getAsSignedConstant().

David Blaikie dblaikie at gmail.com
Mon Oct 6 13:01:13 PDT 2014


================
Comment at: lib/DebugInfo/DWARFFormValue.cpp:554
@@ +553,3 @@
+  if ((!isFormClass(FC_Constant) && !isFormClass(FC_Flag))
+      || Form == DW_FORM_udata)
+    return None;
----------------
hmm - why is udata considered "not signed". It's specifically saying that the value is positive, so should be returned successfully that way, no?

Arguable, I suppose - but I wouldn't put it past implementations to return positive data in _udata to reduce the number of bytes needed to encode it.

================
Comment at: unittests/DebugInfo/DWARFFormValueTest.cpp:103
@@ +102,3 @@
+TEST(DWARFFormValue, SignedConstantForms) {
+  DWARFFormValue data1 = createFromValue(DW_FORM_data1, 0xFF);
+  DWARFFormValue data2 = createFromValue(DW_FORM_data2, 0xFFFF);
----------------
Does this need tests for any other cases? (these tests would all pass with "getAsSignedConstant()" implemented as a single "return -1")

http://reviews.llvm.org/D5630






More information about the llvm-commits mailing list