[PATCH] D36535: [LLD/PDB] Output actual records to the globals stream

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 11:52:13 PDT 2017


rnk added inline comments.


================
Comment at: llvm/lib/DebugInfo/CodeView/RecordName.cpp:280
+
+std::string llvm::codeview::computeSymbolName(CVSymbol Sym) {
+  SymbolVisitorCallbackPipeline Pipeline;
----------------
This isn't really "computing" the name, it just gets it. `getSymbolName` seems more appropriate. It should also return a StringRef. This also needs to be really fast, because we do it on every external symbol. Setting up a deserialization pipeline is probably too much work.

Do any of these require any more work than knowing the offset of the `name` member of the symbol record? I'm thinking we might want to switch to compute the offset, and do the StringRef.split('\0') trick to find the null terminator.


================
Comment at: llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp:95
     // Hash the name to figure out which bucket this goes into.
-    StringRef Name = getSymbolName(Sym);
+    std::string Name = computeSymbolName(Sym);
     size_t BucketIdx = hashStringV1(Name) % IPHR_HASH;
----------------
We do this a lot, this is going to happen once per record. It would be nice to avoid copying the bytes before we hash them.


https://reviews.llvm.org/D36535





More information about the llvm-commits mailing list