summaryrefslogtreecommitdiff
path: root/gnu/llvm/include
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2017-01-24 08:33:38 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2017-01-24 08:33:38 +0000
commit3165dbffa99ce176df0b3568c21636e2967ebdef (patch)
tree997adf46d09d12db5310356961f16a24be02ce8d /gnu/llvm/include
parent9ea554e0446e0e4517c3d01c5a262a88a0514f7a (diff)
Import LLVM 4.0.0 rc1 including clang and lld to help the current
development effort on OpenBSD/arm64.
Diffstat (limited to 'gnu/llvm/include')
-rw-r--r--gnu/llvm/include/llvm/DebugInfo/CodeView/TypeSerializer.h71
1 files changed, 26 insertions, 45 deletions
diff --git a/gnu/llvm/include/llvm/DebugInfo/CodeView/TypeSerializer.h b/gnu/llvm/include/llvm/DebugInfo/CodeView/TypeSerializer.h
index 0e734a8170b..e0592219463 100644
--- a/gnu/llvm/include/llvm/DebugInfo/CodeView/TypeSerializer.h
+++ b/gnu/llvm/include/llvm/DebugInfo/CodeView/TypeSerializer.h
@@ -10,28 +10,21 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
#define LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
-#include "llvm/DebugInfo/CodeView/TypeIndex.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
+#include "llvm/DebugInfo/MSF/ByteStream.h"
+#include "llvm/DebugInfo/MSF/StreamWriter.h"
+
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Allocator.h"
-#include "llvm/Support/BinaryByteStream.h"
-#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/Error.h"
-#include <cassert>
-#include <cstdint>
-#include <memory>
-#include <vector>
namespace llvm {
-namespace codeview {
-class TypeHasher;
+namespace codeview {
class TypeSerializer : public TypeVisitorCallbacks {
struct SubRecord {
@@ -52,54 +45,43 @@ class TypeSerializer : public TypeVisitorCallbacks {
}
};
- using MutableRecordList = SmallVector<MutableArrayRef<uint8_t>, 2>;
+ typedef SmallVector<MutableArrayRef<uint8_t>, 2> RecordList;
static constexpr uint8_t ContinuationLength = 8;
BumpPtrAllocator &RecordStorage;
RecordSegment CurrentSegment;
- MutableRecordList FieldListSegments;
+ RecordList FieldListSegments;
+ TypeIndex LastTypeIndex;
Optional<TypeLeafKind> TypeKind;
Optional<TypeLeafKind> MemberKind;
std::vector<uint8_t> RecordBuffer;
- MutableBinaryByteStream Stream;
- BinaryStreamWriter Writer;
+ msf::MutableByteStream Stream;
+ msf::StreamWriter Writer;
TypeRecordMapping Mapping;
- /// Private type record hashing implementation details are handled here.
- std::unique_ptr<TypeHasher> Hasher;
-
- /// Contains a list of all records indexed by TypeIndex.toArrayIndex().
- SmallVector<ArrayRef<uint8_t>, 2> SeenRecords;
-
- /// Temporary storage that we use to copy a record's data while re-writing
- /// its type indices.
- SmallVector<uint8_t, 256> RemapStorage;
-
- TypeIndex nextTypeIndex() const;
+ RecordList SeenRecords;
+ StringMap<TypeIndex> HashedRecords;
bool isInFieldList() const;
+ TypeIndex calcNextTypeIndex() const;
+ TypeIndex incrementTypeIndex();
MutableArrayRef<uint8_t> getCurrentSubRecordData();
MutableArrayRef<uint8_t> getCurrentRecordData();
Error writeRecordPrefix(TypeLeafKind Kind);
+ TypeIndex insertRecordBytesPrivate(MutableArrayRef<uint8_t> Record);
Expected<MutableArrayRef<uint8_t>>
addPadding(MutableArrayRef<uint8_t> Record);
public:
- explicit TypeSerializer(BumpPtrAllocator &Storage, bool Hash = true);
- ~TypeSerializer() override;
+ explicit TypeSerializer(BumpPtrAllocator &Storage);
- void reset();
-
- BumpPtrAllocator &getAllocator() { return RecordStorage; }
-
- ArrayRef<ArrayRef<uint8_t>> records() const;
- TypeIndex insertRecordBytes(ArrayRef<uint8_t> &Record);
- TypeIndex insertRecord(const RemappedType &Record);
+ ArrayRef<MutableArrayRef<uint8_t>> records() const;
+ TypeIndex getLastTypeIndex() const;
+ TypeIndex insertRecordBytes(MutableArrayRef<uint8_t> Record);
Expected<TypeIndex> visitTypeEndGetIndex(CVType &Record);
- using TypeVisitorCallbacks::visitTypeBegin;
Error visitTypeBegin(CVType &Record) override;
Error visitTypeEnd(CVType &Record) override;
Error visitMemberBegin(CVMemberRecord &Record) override;
@@ -115,7 +97,7 @@ public:
return visitKnownMemberImpl<Name##Record>(CVR, Record); \
}
#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
-#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
+#include "llvm/DebugInfo/CodeView/TypeRecords.def"
private:
template <typename RecordKind>
@@ -152,8 +134,7 @@ private:
return Error::success();
}
};
+}
+}
-} // end namespace codeview
-} // end namespace llvm
-
-#endif // LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
+#endif