[llvm] r273139 - [codeview] Add an extra check for TPI hash values.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 20 00:31:29 PDT 2016
Author: ruiu
Date: Mon Jun 20 02:31:29 2016
New Revision: 273139
URL: http://llvm.org/viewvc/llvm-project?rev=273139&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp?rev=273139&r1=273138&r2=273139&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp Mon Jun 20 02:31:29 2016
@@ -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
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);
}
More information about the llvm-commits
mailing list