diff options
author | Rui Ueyama <ruiu@google.com> | 2016-06-20 07:31:29 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-06-20 07:31:29 +0000 |
commit | 1abbb31bd4be4dc355de055f9ed3a092813fcead (patch) | |
tree | 6c1f07686b7ee42257c4188fa7dbdbbc04ab2e9a /llvm/lib/DebugInfo/PDB | |
parent | e59165ca63d300e9d6b72a0e7d86fa1b88e2038f (diff) | |
download | bcm5719-llvm-1abbb31bd4be4dc355de055f9ed3a092813fcead.tar.gz bcm5719-llvm-1abbb31bd4be4dc355de055f9ed3a092813fcead.zip |
[codeview] Add an extra check for TPI hash values.
This patch adds a function that corresponds to `fUDTAnon`
and use that to compute TPI hash values as the reference does.
llvm-svn: 273139
Diffstat (limited to 'llvm/lib/DebugInfo/PDB')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp index 00ff6e445f7..feb6f2b88d1 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp @@ -64,6 +64,13 @@ TpiStream::TpiStream(const PDBFile &File, TpiStream::~TpiStream() {} +// Corresponds to `fUDTAnon`. +template <typename T> static bool isAnonymous(T &Rec) { + StringRef Name = Rec.getUniqueName(); + return Name == "<unnamed-tag>" || Name == "__unnamed" || + Name.endswith("::<unnamed-tag>") || Name.endswith("::__unnamed"); +} + // Computes a hash for a given TPI record. template <typename T> static uint32_t getTpiHash(T &Rec, const CVRecord<TypeLeafKind> &RawRec) { @@ -73,10 +80,11 @@ static uint32_t getTpiHash(T &Rec, const CVRecord<TypeLeafKind> &RawRec) { Opts & static_cast<uint16_t>(ClassOptions::ForwardReference); bool Scoped = Opts & static_cast<uint16_t>(ClassOptions::Scoped); bool UniqueName = Opts & static_cast<uint16_t>(ClassOptions::HasUniqueName); + bool IsAnon = UniqueName && isAnonymous(Rec); - if (!ForwardRef && !Scoped) + if (!ForwardRef && !Scoped && !IsAnon) return hashStringV1(Rec.getName()); - if (!ForwardRef && UniqueName) + if (!ForwardRef && UniqueName && !IsAnon) return hashStringV1(Rec.getUniqueName()); return hashBufferV8(RawRec.RawData); } |