llvm.org GIT mirror llvm / 1764ef1
Don't crash in llvm-pdbutil when dumping TypeIndexes with high bit set. This is a special code that indicates that it's a function id. While I'm still not certain how to interpret these, we definitely should *not* be using these values as indices into an array directly. For now, when we encounter one of these, just print the numeric value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320775 91177308-0d34-0410-b5e6-96231b3b80d8 Zachary Turner 2 years ago
2 changed file(s) with 3 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
9797 static const uint32_t FirstNonSimpleIndex = 0x1000;
9898 static const uint32_t SimpleKindMask = 0x000000ff;
9999 static const uint32_t SimpleModeMask = 0x00000700;
100 static const uint32_t DecoratedItemIdMask = 0x80000000;
100101
101102 public:
102103 TypeIndex() : Index(static_cast(SimpleTypeKind::None)) {}
109110 uint32_t getIndex() const { return Index; }
110111 void setIndex(uint32_t I) { Index = I; }
111112 bool isSimple() const { return Index < FirstNonSimpleIndex; }
113 bool isDecoratedItemId() const { return !!(Index & DecoratedItemIdMask); }
112114
113115 bool isNoneType() const { return *this == None(); }
114116
336336
337337 std::string MinimalSymbolDumper::typeOrIdIndex(codeview::TypeIndex TI,
338338 bool IsType) const {
339 if (TI.isSimple())
339 if (TI.isSimple() || TI.isDecoratedItemId())
340340 return formatv("{0}", TI).str();
341341 auto &Container = IsType ? Types : Ids;
342342 StringRef Name = Container.getTypeName(TI);