1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

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.

llvm-svn: 320775
This commit is contained in:
Zachary Turner 2017-12-15 00:27:49 +00:00
parent 3b48c1eb32
commit d2ace26a79
2 changed files with 3 additions and 1 deletions

View File

@ -98,6 +98,7 @@ public:
static const uint32_t FirstNonSimpleIndex = 0x1000;
static const uint32_t SimpleKindMask = 0x000000ff;
static const uint32_t SimpleModeMask = 0x00000700;
static const uint32_t DecoratedItemIdMask = 0x80000000;
public:
TypeIndex() : Index(static_cast<uint32_t>(SimpleTypeKind::None)) {}
@ -110,6 +111,7 @@ public:
uint32_t getIndex() const { return Index; }
void setIndex(uint32_t I) { Index = I; }
bool isSimple() const { return Index < FirstNonSimpleIndex; }
bool isDecoratedItemId() const { return !!(Index & DecoratedItemIdMask); }
bool isNoneType() const { return *this == None(); }

View File

@ -337,7 +337,7 @@ Error MinimalSymbolDumper::visitSymbolEnd(CVSymbol &Record) {
std::string MinimalSymbolDumper::typeOrIdIndex(codeview::TypeIndex TI,
bool IsType) const {
if (TI.isSimple())
if (TI.isSimple() || TI.isDecoratedItemId())
return formatv("{0}", TI).str();
auto &Container = IsType ? Types : Ids;
StringRef Name = Container.getTypeName(TI);