Commit 732e443b authored by Paul Robinson's avatar Paul Robinson
Browse files

Revert "[DWARFv5] Emit file 0 to the line table."

Caused an asan failure.

This reverts commit d54883f0.
aka r326758

llvm-svn: 326762
parent 8fd561f5
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -537,13 +537,8 @@ namespace llvm {
      DwarfCompileUnitID = CUIndex;
    }

    /// Specifies the "root" file and directory of the compilation unit.
    /// These are "file 0" and "directory 0" in DWARF v5.
    void setMCLineTableRootFile(unsigned CUID, StringRef CompilationDir,
                                StringRef Filename, MD5::MD5Result *Checksum,
                                Optional<StringRef> Source) {
      getMCDwarfLineTable(CUID).setRootFile(CompilationDir, Filename, Checksum,
                                            Source);
    void setMCLineTableCompilationDir(unsigned CUID, StringRef CompilationDir) {
      getMCDwarfLineTable(CUID).setCompilationDir(CompilationDir);
    }

    /// Saves the information from the currently parsed dwarf .loc directive
+6 −23
Original line number Diff line number Diff line
@@ -214,7 +214,6 @@ struct MCDwarfLineTableHeader {
  SmallVector<MCDwarfFile, 3> MCDwarfFiles;
  StringMap<unsigned> SourceIdMap;
  StringRef CompilationDir;
  MCDwarfFile RootFile;
  bool HasMD5 = false;
  bool HasSource = false;

@@ -242,17 +241,8 @@ class MCDwarfDwoLineTable {
  MCDwarfLineTableHeader Header;

public:
  void maybeSetRootFile(StringRef Directory, StringRef FileName,
                        MD5::MD5Result *Checksum, Optional<StringRef> Source) {
    if (!Header.RootFile.Name.empty())
      return;
    Header.CompilationDir = Directory;
    Header.RootFile.Name = FileName;
    Header.RootFile.DirIndex = 0;
    Header.RootFile.Checksum = Checksum;
    Header.RootFile.Source = Source;
    Header.HasMD5 = (Checksum != nullptr);
    Header.HasSource = Source.hasValue();
  void setCompilationDir(StringRef CompilationDir) {
    Header.CompilationDir = CompilationDir;
  }

  unsigned getFile(StringRef Directory, StringRef FileName,
@@ -286,17 +276,6 @@ public:
                               FileNumber));
  }

  void setRootFile(StringRef Directory, StringRef FileName,
                   MD5::MD5Result *Checksum, Optional<StringRef> Source) {
    Header.CompilationDir = Directory;
    Header.RootFile.Name = FileName;
    Header.RootFile.DirIndex = 0;
    Header.RootFile.Checksum = Checksum;
    Header.RootFile.Source = Source;
    Header.HasMD5 = (Checksum != nullptr);
    Header.HasSource = Source.hasValue();
  }

  MCSymbol *getLabel() const {
    return Header.Label;
  }
@@ -305,6 +284,10 @@ public:
    Header.Label = Label;
  }

  void setCompilationDir(StringRef CompilationDir) {
    Header.CompilationDir = CompilationDir;
  }

  const SmallVectorImpl<std::string> &getMCDwarfDirs() const {
    return Header.MCDwarfDirs;
  }
+0 −6
Original line number Diff line number Diff line
@@ -774,12 +774,6 @@ public:
      MD5::MD5Result *Checksum = nullptr, Optional<StringRef> Source = None,
      unsigned CUID = 0);

  /// Specify the "root" file of the compilation, using the ".file 0" extension.
  virtual void emitDwarfFile0Directive(StringRef Directory, StringRef Filename,
                                       MD5::MD5Result *Checksum,
                                       Optional<StringRef> Source,
                                       unsigned CUID = 0);

  /// \brief This implements the DWARF2 '.loc fileno lineno ...' assembler
  /// directive.
  virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
+4 −7
Original line number Diff line number Diff line
@@ -476,9 +476,8 @@ DwarfDebug::getOrCreateDwarfCompileUnit(const DICompileUnit *DIUnit) {
  // explicitly describe the directory of all files, never relying on the
  // compilation directory.
  if (!Asm->OutStreamer->hasRawTextSupport() || SingleCU)
    Asm->OutStreamer->emitDwarfFile0Directive(
        CompilationDir, FN, NewCU.getMD5AsBytes(DIUnit->getFile()),
        DIUnit->getSource(), NewCU.getUniqueID());
    Asm->OutStreamer->getContext().setMCLineTableCompilationDir(
        NewCU.getUniqueID(), CompilationDir);

  StringRef Producer = DIUnit->getProducer();
  StringRef Flags = DIUnit->getFlags();
@@ -2111,10 +2110,8 @@ void DwarfDebug::emitDebugStrDWO() {
MCDwarfDwoLineTable *DwarfDebug::getDwoLineTable(const DwarfCompileUnit &CU) {
  if (!useSplitDwarf())
    return nullptr;
  const DICompileUnit *DIUnit = CU.getCUNode();
  SplitTypeUnitFileTable.maybeSetRootFile(
      DIUnit->getDirectory(), DIUnit->getFilename(),
      CU.getMD5AsBytes(DIUnit->getFile()), DIUnit->getSource());
  if (SingleCU)
    SplitTypeUnitFileTable.setCompilationDir(CU.getCUNode()->getDirectory());
  return &SplitTypeUnitFileTable;
}

+1 −1
Original line number Diff line number Diff line
@@ -284,7 +284,7 @@ void DwarfUnit::addSectionOffset(DIE &Die, dwarf::Attribute Attribute,
    addUInt(Die, Attribute, dwarf::DW_FORM_data4, Integer);
}

MD5::MD5Result *DwarfUnit::getMD5AsBytes(const DIFile *File) const {
MD5::MD5Result *DwarfUnit::getMD5AsBytes(const DIFile *File) {
  assert(File);
  Optional<DIFile::ChecksumInfo<StringRef>> Checksum = File->getChecksum();
  if (!Checksum || Checksum->Kind != DIFile::CSK_MD5)
Loading