aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/DebugInfo/CodeView/TypeIndex.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/DebugInfo/CodeView/TypeIndex.h')
-rw-r--r--include/llvm/DebugInfo/CodeView/TypeIndex.h76
1 files changed, 46 insertions, 30 deletions
diff --git a/include/llvm/DebugInfo/CodeView/TypeIndex.h b/include/llvm/DebugInfo/CodeView/TypeIndex.h
index d3a541be4c62..c2ebf3848892 100644
--- a/include/llvm/DebugInfo/CodeView/TypeIndex.h
+++ b/include/llvm/DebugInfo/CodeView/TypeIndex.h
@@ -10,6 +10,7 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPEINDEX_H
#define LLVM_DEBUGINFO_CODEVIEW_TYPEINDEX_H
+#include "llvm/Support/Endian.h"
#include <cassert>
#include <cinttypes>
@@ -26,6 +27,8 @@ enum class SimpleTypeKind : uint32_t {
UnsignedCharacter = 0x0020, // 8 bit unsigned
NarrowCharacter = 0x0070, // really a char
WideCharacter = 0x0071, // wide char
+ Character16 = 0x007a, // char16_t
+ Character32 = 0x007b, // char32_t
SByte = 0x0068, // 8 bit signed int
Byte = 0x0069, // 8 bit unsigned int
@@ -41,6 +44,8 @@ enum class SimpleTypeKind : uint32_t {
UInt64Quad = 0x0023, // 64 bit unsigned
Int64 = 0x0076, // 64 bit signed int
UInt64 = 0x0077, // 64 bit unsigned int
+ Int128Oct = 0x0014, // 128 bit signed int
+ UInt128Oct = 0x0024, // 128 bit unsigned int
Int128 = 0x0078, // 128 bit signed int
UInt128 = 0x0079, // 128 bit unsigned int
@@ -52,15 +57,19 @@ enum class SimpleTypeKind : uint32_t {
Float80 = 0x0042, // 80 bit real
Float128 = 0x0043, // 128 bit real
- Complex32 = 0x0050, // 32 bit complex
- Complex64 = 0x0051, // 64 bit complex
- Complex80 = 0x0052, // 80 bit complex
- Complex128 = 0x0053, // 128 bit complex
-
- Boolean8 = 0x0030, // 8 bit boolean
- Boolean16 = 0x0031, // 16 bit boolean
- Boolean32 = 0x0032, // 32 bit boolean
- Boolean64 = 0x0033 // 64 bit boolean
+ Complex16 = 0x0056, // 16 bit complex
+ Complex32 = 0x0050, // 32 bit complex
+ Complex32PartialPrecision = 0x0055, // 32 bit PP complex
+ Complex48 = 0x0054, // 48 bit complex
+ Complex64 = 0x0051, // 64 bit complex
+ Complex80 = 0x0052, // 80 bit complex
+ Complex128 = 0x0053, // 128 bit complex
+
+ Boolean8 = 0x0030, // 8 bit boolean
+ Boolean16 = 0x0031, // 16 bit boolean
+ Boolean32 = 0x0032, // 32 bit boolean
+ Boolean64 = 0x0033, // 64 bit boolean
+ Boolean128 = 0x0034, // 128 bit boolean
};
enum class SimpleTypeMode : uint32_t {
@@ -74,6 +83,9 @@ enum class SimpleTypeMode : uint32_t {
NearPointer128 = 0x00000700 // 128 bit near pointer
};
+/// A 32-bit type reference. Types are indexed by their order of appearance in
+/// .debug$T plus 0x1000. Type indices less than 0x1000 are "simple" types,
+/// composed of a SimpleTypeMode byte followed by a SimpleTypeKind byte.
class TypeIndex {
public:
static const uint32_t FirstNonSimpleIndex = 0x1000;
@@ -91,6 +103,8 @@ public:
uint32_t getIndex() const { return Index; }
bool isSimple() const { return Index < FirstNonSimpleIndex; }
+ bool isNoneType() const { return *this == None(); }
+
SimpleTypeKind getSimpleKind() const {
assert(isSimple());
return static_cast<SimpleTypeKind>(Index & SimpleKindMask);
@@ -101,6 +115,7 @@ public:
return static_cast<SimpleTypeMode>(Index & SimpleModeMask);
}
+ static TypeIndex None() { return TypeIndex(SimpleTypeKind::None); }
static TypeIndex Void() { return TypeIndex(SimpleTypeKind::Void); }
static TypeIndex VoidPointer32() {
return TypeIndex(SimpleTypeKind::Void, SimpleTypeMode::NearPointer32);
@@ -143,33 +158,34 @@ public:
static TypeIndex Float32() { return TypeIndex(SimpleTypeKind::Float32); }
static TypeIndex Float64() { return TypeIndex(SimpleTypeKind::Float64); }
-private:
- uint32_t Index;
-};
+ friend inline bool operator==(const TypeIndex &A, const TypeIndex &B) {
+ return A.getIndex() == B.getIndex();
+ }
-inline bool operator==(const TypeIndex &A, const TypeIndex &B) {
- return A.getIndex() == B.getIndex();
-}
+ friend inline bool operator!=(const TypeIndex &A, const TypeIndex &B) {
+ return A.getIndex() != B.getIndex();
+ }
-inline bool operator!=(const TypeIndex &A, const TypeIndex &B) {
- return A.getIndex() != B.getIndex();
-}
+ friend inline bool operator<(const TypeIndex &A, const TypeIndex &B) {
+ return A.getIndex() < B.getIndex();
+ }
-inline bool operator<(const TypeIndex &A, const TypeIndex &B) {
- return A.getIndex() < B.getIndex();
-}
+ friend inline bool operator<=(const TypeIndex &A, const TypeIndex &B) {
+ return A.getIndex() <= B.getIndex();
+ }
-inline bool operator<=(const TypeIndex &A, const TypeIndex &B) {
- return A.getIndex() <= B.getIndex();
-}
+ friend inline bool operator>(const TypeIndex &A, const TypeIndex &B) {
+ return A.getIndex() > B.getIndex();
+ }
-inline bool operator>(const TypeIndex &A, const TypeIndex &B) {
- return A.getIndex() > B.getIndex();
-}
+ friend inline bool operator>=(const TypeIndex &A, const TypeIndex &B) {
+ return A.getIndex() >= B.getIndex();
+ }
+
+private:
+ support::ulittle32_t Index;
+};
-inline bool operator>=(const TypeIndex &A, const TypeIndex &B) {
- return A.getIndex() >= B.getIndex();
-}
}
}