COFF: Merge DefinedRegular and DefinedCOMDAT.
I split them in r240319 because I thought they are different enough
that we should treat them as different types. It turned out that
that was not a good idea. They are so similar that we ended up having
many duplicate code.
llvm-svn: 240706
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index 9a15827..d11c265 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -215,10 +215,8 @@
}
Chunk *C = SparseChunks[Sym.getSectionNumber()];
if (auto *SC = cast_or_null<SectionChunk>(C)) {
- if (!SC->isCOMDAT())
- return new (Alloc) DefinedRegular(COFFObj.get(), Sym, SC);
- auto *B = new (Alloc) DefinedCOMDAT(COFFObj.get(), Sym, SC);
- if (Sym.getValue() == 0 && !AuxP)
+ auto *B = new (Alloc) DefinedRegular(COFFObj.get(), Sym, SC);
+ if (SC->isCOMDAT() && Sym.getValue() == 0 && !AuxP)
SC->setSymbol(B);
return B;
}