[PATCH] D45104: [COFF] Fix reading variable-length encoded records

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 9 19:01:57 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL329659: [DebugInfo][COFF] Fix reading variable-length encoded records (authored by aganea, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D45104?vs=140798&id=141783#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D45104

Files:
  llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
  llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp


Index: llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
===================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
+++ llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
@@ -58,7 +58,7 @@
       8,  // LF_UQUADWORD
   };
 
-  return Sizes[N - LF_NUMERIC];
+  return 2 + Sizes[N - LF_NUMERIC];
 }
 
 static inline uint32_t getCStringLength(ArrayRef<uint8_t> Data) {
@@ -393,7 +393,7 @@
     Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type
     break;
   case SymbolKind::S_REGISTER:
-    Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type;
+    Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type
     break;
   case SymbolKind::S_CONSTANT:
     Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type
Index: llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
===================================================================
--- llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
+++ llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
@@ -593,3 +593,11 @@
   writeTypeRecords(P, EP);
   checkTypeReferences(0);
 }
+
+// This is a test for getEncodedIntegerLength()
+TEST_F(TypeIndexIteratorTest, VariableSizeIntegers) {
+  BaseClassRecord BaseClass1(MemberAccess::Public, TypeIndex(47), (uint64_t)-1);
+  BaseClassRecord BaseClass2(MemberAccess::Public, TypeIndex(48), 1);
+  writeFieldList(BaseClass1, BaseClass2);
+  checkTypeReferences(0, TypeIndex(47), TypeIndex(48));
+}
\ No newline at end of file


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45104.141783.patch
Type: text/x-patch
Size: 1539 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180410/c2452669/attachment.bin>


More information about the llvm-commits mailing list