diff options
| author | Zachary Turner <zturner@google.com> | 2017-11-28 23:57:13 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2017-11-28 23:57:13 +0000 |
| commit | 29b081dcd182275396c900d765ba6e2160507700 (patch) | |
| tree | a5574d1f7da8f83f9829e0901d20c97c9580d638 /llvm/lib/DebugInfo/CodeView | |
| parent | 88ffb5d4d5c675afa013877f20922b928836b74f (diff) | |
| download | bcm5719-llvm-29b081dcd182275396c900d765ba6e2160507700.tar.gz bcm5719-llvm-29b081dcd182275396c900d765ba6e2160507700.zip | |
[NFC] Minor cleanups in CodeView TypeTableBuilder.
llvm-svn: 319260
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView')
| -rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp b/llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp index bce636f3894..7b02b175bd6 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp @@ -31,9 +31,8 @@ using namespace llvm::codeview; namespace { struct HashedType { - uint64_t Hash; - const uint8_t *Data; - unsigned Size; // FIXME: Go to uint16_t? + unsigned Hash; + ArrayRef<uint8_t> Data; TypeIndex Index; }; @@ -67,9 +66,9 @@ template <> struct DenseMapInfo<HashedTypePtr> { HashedType *RHS = RHSP.Ptr; if (RHS == getEmptyKey().Ptr || RHS == getTombstoneKey().Ptr) return LHS == RHS; - if (LHS->Hash != RHS->Hash || LHS->Size != RHS->Size) + if (LHS->Hash != RHS->Hash) return false; - return ::memcmp(LHS->Data, RHS->Data, LHS->Size) == 0; + return LHS->Data == RHS->Data; } }; @@ -111,8 +110,7 @@ TypeIndex TypeHasher::getOrCreateRecord(ArrayRef<uint8_t> &Record, assert(Record.size() % 4 == 0 && "Record is not aligned to 4 bytes!"); // Compute the hash up front so we can store it in the key. - HashedType TempHashedType = {hash_value(Record), Record.data(), - unsigned(Record.size()), TI}; + HashedType TempHashedType = {hash_value(Record), Record, TI}; auto Result = HashedRecords.insert(HashedTypePtr(&TempHashedType)); HashedType *&Hashed = Result.first->Ptr; @@ -124,12 +122,11 @@ TypeIndex TypeHasher::getOrCreateRecord(ArrayRef<uint8_t> &Record, uint8_t *Stable = RecordStorage.Allocate<uint8_t>(Record.size()); memcpy(Stable, Record.data(), Record.size()); - Hashed->Data = Stable; - assert(Hashed->Size == Record.size()); + Hashed->Data = makeArrayRef(Stable, Record.size()); } // Update the caller's copy of Record to point a stable copy. - Record = ArrayRef<uint8_t>(Hashed->Data, Hashed->Size); + Record = Hashed->Data; return Hashed->Index; } |

