[PATCH] D109634: [LLD] Remove global state in lld/COFF

Amy Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 10 16:42:53 PDT 2021


akhuang marked an inline comment as done.
akhuang added inline comments.


================
Comment at: lld/COFF/DebugTypes.cpp:934
   /// Get the ghash key for this cell.
-  GloballyHashedType getGHash() const {
-    return TpiSource::instances[getTpiSrcIdx()]->ghashes[getGHashIdx()];
+  GloballyHashedType getGHash(std::vector<TpiSource *> instances) const {
+    return instances[getTpiSrcIdx()]->ghashes[getGHashIdx()];
----------------
amccarth wrote:
> It looks like you're passing the entire vector in.  I think you meant to pass it by reference (probably even const reference):
> 
> `const std::vector<TpiSource *> &instances`
> 
not sure why I decided to pass the vector here instead of just &ctx like I did everywhere else? Might as well do that here, too


================
Comment at: lld/COFF/Driver.cpp:75
     freeArena();
-    ObjFile::instances.clear();
-    PDBInputFile::instances.clear();
-    ImportFile::instances.clear();
-    BitcodeFile::instances.clear();
-    memset(MergeChunk::instances, 0, sizeof(MergeChunk::instances));
-    OutputSection::clear();
+    // memset(MergeChunk::instances, 0, sizeof(MergeChunk::instances));
   };
----------------
amccarth wrote:
> Consider deleting the memset rather than commenting it out.
whoops, 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109634/new/

https://reviews.llvm.org/D109634



More information about the llvm-commits mailing list