[PDB] Don't emit debug info associated with dead chunks

Summary:
Previously we didn't add debug info chunks to the SparseChunks array, so
they didn't participate in section GC. Now we do.

Reviewers: ruiu

Subscribers: aprantl, llvm-commits

Differential Revision: https://reviews.llvm.org/D34356

llvm-svn: 305811
diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index 380e301..81ef6af 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -164,10 +164,7 @@
 
     // Now do all line info.
     for (SectionChunk *DebugChunk : File->getDebugChunks()) {
-      // FIXME: Debug chunks do not have a correct isLive() bit.
-      // FIXME: When linker GC is off we need to ignore debug info whose
-      // associated symbol was discarded.
-      if (DebugChunk->getSectionName() != ".debug$S")
+      if (!DebugChunk->isLive() || DebugChunk->getSectionName() != ".debug$S")
         continue;
 
       ArrayRef<uint8_t> RelocatedDebugContents =