[llvm] r302053 - [CodeView] Use actual strings for dealing with checksums and lines.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 12:12:35 PDT 2017


I'm getting an unused private member warning on the string table in
ModuleDebugInlineeLinesFragment. Can you take a look?

~Craig

On Wed, May 3, 2017 at 10:11 AM, Zachary Turner via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: zturner
> Date: Wed May  3 12:11:40 2017
> New Revision: 302053
>
> URL: http://llvm.org/viewvc/llvm-project?rev=302053&view=rev
> Log:
> [CodeView] Use actual strings for dealing with checksums and lines.
>
> The raw CodeView format references strings by "offsets", but it's
> confusing what table the offset refers to.  In the case of line
> number information, it's an offset into a buffer of records,
> and an indirection is required to get another offset into a
> different table to find the final string.  And in the case of
> checksum information, there is no indirection, and the offset
> refers directly to the location of the string in another buffer.
>
> This would be less confusing if we always just referred to the
> strings by their value, and have the library be smart enough
> to correctly resolve the offsets on its own from the right
> location.
>
> This patch makes that possible.  When either reading or writing,
> all the user deals with are strings, and the library does the
> appropriate translations behind the scenes.
>
> Modified:
>     llvm/trunk/include/llvm/DebugInfo/CodeView/
> ModuleDebugFileChecksumFragment.h
>     llvm/trunk/include/llvm/DebugInfo/CodeView/
> ModuleDebugInlineeLinesFragment.h
>     llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h
>     llvm/trunk/include/llvm/DebugInfo/CodeView/StringTable.h
>     llvm/trunk/include/llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h
>     llvm/trunk/include/llvm/Support/BinaryStreamArray.h
>     llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp
>     llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp
>     llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugLineFragment.cpp
>     llvm/trunk/lib/DebugInfo/CodeView/StringTable.cpp
>     llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
>
> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/
> ModuleDebugFileChecksumFragment.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/
> llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragmen
> t.h?rev=302053&r1=302052&r2=302053&view=diff
> ============================================================
> ==================
> --- llvm/trunk/include/llvm/DebugInfo/CodeView/
> ModuleDebugFileChecksumFragment.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/
> ModuleDebugFileChecksumFragment.h Wed May  3 12:11:40 2017
> @@ -21,6 +21,8 @@
>  namespace llvm {
>  namespace codeview {
>
> +class StringTable;
> +
>  struct FileChecksumEntry {
>    uint32_t FileNameOffset;    // Byte offset of filename in global
> stringtable.
>    FileChecksumKind Kind;      // The type of checksum.
> @@ -66,20 +68,22 @@ private:
>
>  class ModuleDebugFileChecksumFragment final : public ModuleDebugFragment
> {
>  public:
> -  ModuleDebugFileChecksumFragment();
> +  explicit ModuleDebugFileChecksumFragment(StringTable &Strings);
>
>    static bool classof(const ModuleDebugFragment *S) {
>      return S->kind() == ModuleDebugFragmentKind::FileChecksums;
>    }
>
> -  void addChecksum(uint32_t StringTableOffset, FileChecksumKind Kind,
> +  void addChecksum(StringRef FileName, FileChecksumKind Kind,
>                     ArrayRef<uint8_t> Bytes);
>
>    uint32_t calculateSerializedLength() override;
>    Error commit(BinaryStreamWriter &Writer) override;
> -  uint32_t mapChecksumOffset(uint32_t StringTableOffset) const;
> +  uint32_t mapChecksumOffset(StringRef FileName) const;
>
>  private:
> +  StringTable &Strings;
> +
>    DenseMap<uint32_t, uint32_t> OffsetMap;
>    uint32_t SerializedSize = 0;
>    llvm::BumpPtrAllocator Storage;
>
> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/
> ModuleDebugInlineeLinesFragment.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/
> llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragmen
> t.h?rev=302053&r1=302052&r2=302053&view=diff
> ============================================================
> ==================
> --- llvm/trunk/include/llvm/DebugInfo/CodeView/
> ModuleDebugInlineeLinesFragment.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/
> ModuleDebugInlineeLinesFragment.h Wed May  3 12:11:40 2017
> @@ -20,6 +20,8 @@ namespace llvm {
>  namespace codeview {
>
>  class ModuleDebugInlineeLineFragmentRef;
> +class ModuleDebugFileChecksumFragment;
> +class StringTable;
>
>  enum class InlineeLinesSignature : uint32_t {
>    Normal,    // CV_INLINEE_SOURCE_LINE_SIGNATURE
> @@ -73,7 +75,8 @@ private:
>
>  class ModuleDebugInlineeLineFragment final : public ModuleDebugFragment {
>  public:
> -  explicit ModuleDebugInlineeLineFragment(bool HasExtraFiles);
> +  ModuleDebugInlineeLineFragment(ModuleDebugFileChecksumFragment
> &Checksums,
> +                                 StringTable &Strings, bool
> HasExtraFiles);
>
>    static bool classof(const ModuleDebugFragment *S) {
>      return S->kind() == ModuleDebugFragmentKind::InlineeLines;
> @@ -82,11 +85,13 @@ public:
>    Error commit(BinaryStreamWriter &Writer) override;
>    uint32_t calculateSerializedLength() override;
>
> -  void addInlineSite(TypeIndex FuncId, uint32_t FileOffset,
> -                     uint32_t SourceLine);
> -  void addExtraFile(uint32_t FileOffset);
> +  void addInlineSite(TypeIndex FuncId, StringRef FileName, uint32_t
> SourceLine);
> +  void addExtraFile(StringRef FileName);
>
>  private:
> +  ModuleDebugFileChecksumFragment &Checksums;
> +  StringTable &Strings;
> +
>    bool HasExtraFiles = false;
>    uint32_t ExtraFileCount = 0;
>
>
> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/
> ModuleDebugLineFragment.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/
> llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h?rev=
> 302053&r1=302052&r2=302053&view=diff
> ============================================================
> ==================
> --- llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h
> (original)
> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h
> Wed May  3 12:11:40 2017
> @@ -19,6 +19,9 @@
>  namespace llvm {
>  namespace codeview {
>
> +class ModuleDebugFileChecksumFragment;
> +class StringTable;
> +
>  // Corresponds to the `CV_DebugSLinesHeader_t` structure.
>  struct LineFragmentHeader {
>    support::ulittle32_t RelocOffset;  // Code offset of line contribution.
> @@ -104,13 +107,14 @@ class ModuleDebugLineFragment final : pu
>    };
>
>  public:
> -  ModuleDebugLineFragment();
> +  ModuleDebugLineFragment(ModuleDebugFileChecksumFragment &Checksums,
> +                          StringTable &Strings);
>
>    static bool classof(const ModuleDebugFragment *S) {
>      return S->kind() == ModuleDebugFragmentKind::Lines;
>    }
>
> -  void createBlock(uint32_t ChecksumBufferOffset);
> +  void createBlock(StringRef FileName);
>    void addLineInfo(uint32_t Offset, const LineInfo &Line);
>    void addLineAndColumnInfo(uint32_t Offset, const LineInfo &Line,
>                              uint32_t ColStart, uint32_t ColEnd);
> @@ -125,6 +129,9 @@ public:
>    bool hasColumnInfo() const;
>
>  private:
> +  ModuleDebugFileChecksumFragment &Checksums;
> +  StringTable &Strings;
> +
>    uint16_t RelocOffset = 0;
>    uint16_t RelocSegment = 0;
>    uint32_t CodeSize = 0;
>
> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/StringTable.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/
> llvm/DebugInfo/CodeView/StringTable.h?rev=302053&r1=
> 302052&r2=302053&view=diff
> ============================================================
> ==================
> --- llvm/trunk/include/llvm/DebugInfo/CodeView/StringTable.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/StringTable.h Wed May  3
> 12:11:40 2017
> @@ -53,6 +53,9 @@ public:
>    // Returns the ID for S.
>    uint32_t insert(StringRef S);
>
> +  // Return the ID for string S.  Assumes S exists in the table.
> +  uint32_t getStringId(StringRef S) const;
> +
>    uint32_t calculateSerializedSize() const;
>    Error commit(BinaryStreamWriter &Writer) const;
>
>
> Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/
> PDBStringTableBuilder.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/
> llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h?rev=
> 302053&r1=302052&r2=302053&view=diff
> ============================================================
> ==================
> --- llvm/trunk/include/llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h
> (original)
> +++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h
> Wed May  3 12:11:40 2017
> @@ -41,6 +41,9 @@ public:
>    uint32_t calculateSerializedSize() const;
>    Error commit(BinaryStreamWriter &Writer) const;
>
> +  codeview::StringTable &getStrings() { return Strings; }
> +  const codeview::StringTable &getStrings() const { return Strings; }
> +
>  private:
>    uint32_t calculateHashTableSize() const;
>    Error writeHeader(BinaryStreamWriter &Writer) const;
>
> Modified: llvm/trunk/include/llvm/Support/BinaryStreamArray.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/
> BinaryStreamArray.h?rev=302053&r1=302052&r2=302053&view=diff
> ============================================================
> ==================
> --- llvm/trunk/include/llvm/Support/BinaryStreamArray.h (original)
> +++ llvm/trunk/include/llvm/Support/BinaryStreamArray.h Wed May  3
> 12:11:40 2017
> @@ -223,6 +223,8 @@ public:
>      return Iterator(*this, Ctx, Stream, HadError);
>    }
>
> +  bool valid() const { return Stream.valid(); }
> +
>    Iterator end() const { return Iterator(Ctx); }
>
>    bool empty() const { return Stream.getLength() == 0; }
>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragmen
> t.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> DebugInfo/CodeView/ModuleDebugFileChecksumFragmen
> t.cpp?rev=302053&r1=302052&r2=302053&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp
> (original)
> +++ llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp
> Wed May  3 12:11:40 2017
> @@ -10,6 +10,7 @@
>  #include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"
>
>  #include "llvm/DebugInfo/CodeView/CodeViewError.h"
> +#include "llvm/DebugInfo/CodeView/StringTable.h"
>  #include "llvm/Support/BinaryStreamReader.h"
>
>  using namespace llvm;
> @@ -49,10 +50,12 @@ Error ModuleDebugFileChecksumFragmentRef
>    return Error::success();
>  }
>
> -ModuleDebugFileChecksumFragment::ModuleDebugFileChecksumFragment()
> -    : ModuleDebugFragment(ModuleDebugFragmentKind::FileChecksums) {}
> +ModuleDebugFileChecksumFragment::ModuleDebugFileChecksumFragment(
> +    StringTable &Strings)
> +    : ModuleDebugFragment(ModuleDebugFragmentKind::FileChecksums),
> +      Strings(Strings) {}
>
> -void ModuleDebugFileChecksumFragment::addChecksum(uint32_t
> StringTableOffset,
> +void ModuleDebugFileChecksumFragment::addChecksum(StringRef FileName,
>                                                    FileChecksumKind Kind,
>                                                    ArrayRef<uint8_t>
> Bytes) {
>    FileChecksumEntry Entry;
> @@ -61,13 +64,14 @@ void ModuleDebugFileChecksumFragment::ad
>      ::memcpy(Copy, Bytes.data(), Bytes.size());
>      Entry.Checksum = makeArrayRef(Copy, Bytes.size());
>    }
> -  Entry.FileNameOffset = StringTableOffset;
> +
> +  Entry.FileNameOffset = Strings.insert(FileName);
>    Entry.Kind = Kind;
>    Checksums.push_back(Entry);
>
>    // This maps the offset of this string in the string table to the offset
>    // of this checksum entry in the checksum buffer.
> -  OffsetMap[StringTableOffset] = SerializedSize;
> +  OffsetMap[Entry.FileNameOffset] = SerializedSize;
>    assert(SerializedSize % 4 == 0);
>
>    uint32_t Len = alignTo(sizeof(FileChecksumEntryHeader) + Bytes.size(),
> 4);
> @@ -94,9 +98,10 @@ Error ModuleDebugFileChecksumFragment::c
>    return Error::success();
>  }
>
> -uint32_t ModuleDebugFileChecksumFragment::mapChecksumOffset(
> -    uint32_t StringTableOffset) const {
> -  auto Iter = OffsetMap.find(StringTableOffset);
> +uint32_t
> +ModuleDebugFileChecksumFragment::mapChecksumOffset(StringRef FileName)
> const {
> +  uint32_t Offset = Strings.getStringId(FileName);
> +  auto Iter = OffsetMap.find(Offset);
>    assert(Iter != OffsetMap.end());
>    return Iter->second;
>  }
>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragmen
> t.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> DebugInfo/CodeView/ModuleDebugInlineeLinesFragmen
> t.cpp?rev=302053&r1=302052&r2=302053&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp
> (original)
> +++ llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp
> Wed May  3 12:11:40 2017
> @@ -10,7 +10,9 @@
>  #include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"
>
>  #include "llvm/DebugInfo/CodeView/CodeViewError.h"
> +#include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"
>  #include "llvm/DebugInfo/CodeView/ModuleDebugFragmentRecord.h"
> +#include "llvm/DebugInfo/CodeView/StringTable.h"
>
>  using namespace llvm;
>  using namespace llvm::codeview;
> @@ -55,9 +57,10 @@ bool ModuleDebugInlineeLineFragmentRef::
>  }
>
>  ModuleDebugInlineeLineFragment::ModuleDebugInlineeLineFragment(
> +    ModuleDebugFileChecksumFragment &Checksums, StringTable &Strings,
>      bool HasExtraFiles)
>      : ModuleDebugFragment(ModuleDebugFragmentKind::InlineeLines),
> -      HasExtraFiles(HasExtraFiles) {}
> +      Checksums(Checksums), Strings(Strings),
> HasExtraFiles(HasExtraFiles) {}
>
>  uint32_t ModuleDebugInlineeLineFragment::calculateSerializedLength() {
>    // 4 bytes for the signature
> @@ -100,18 +103,22 @@ Error ModuleDebugInlineeLineFragment::co
>    return Error::success();
>  }
>
> -void ModuleDebugInlineeLineFragment::addExtraFile(uint32_t FileOffset) {
> +void ModuleDebugInlineeLineFragment::addExtraFile(StringRef FileName) {
> +  uint32_t Offset = Checksums.mapChecksumOffset(FileName);
> +
>    auto &Entry = Entries.back();
> -  Entry.ExtraFiles.push_back(ulittle32_t(FileOffset));
> +  Entry.ExtraFiles.push_back(ulittle32_t(Offset));
>    ++ExtraFileCount;
>  }
>
>  void ModuleDebugInlineeLineFragment::addInlineSite(TypeIndex FuncId,
> -                                                   uint32_t FileOffset,
> +                                                   StringRef FileName,
>                                                     uint32_t SourceLine) {
> +  uint32_t Offset = Checksums.mapChecksumOffset(FileName);
> +
>    Entries.emplace_back();
>    auto &Entry = Entries.back();
> -  Entry.Header.FileID = FileOffset;
> +  Entry.Header.FileID = Offset;
>    Entry.Header.SourceLineNum = SourceLine;
>    Entry.Header.Inlinee = FuncId;
>  }
>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugLineFragment.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> DebugInfo/CodeView/ModuleDebugLineFragment.cpp?rev=302053&r1=302052&r2=
> 302053&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugLineFragment.cpp
> (original)
> +++ llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugLineFragment.cpp Wed
> May  3 12:11:40 2017
> @@ -10,7 +10,9 @@
>  #include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h"
>
>  #include "llvm/DebugInfo/CodeView/CodeViewError.h"
> +#include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"
>  #include "llvm/DebugInfo/CodeView/ModuleDebugFragmentRecord.h"
> +#include "llvm/DebugInfo/CodeView/StringTable.h"
>
>  using namespace llvm;
>  using namespace llvm::codeview;
> @@ -65,11 +67,15 @@ bool ModuleDebugLineFragmentRef::hasColu
>    return !!(Header->Flags & LF_HaveColumns);
>  }
>
> -ModuleDebugLineFragment::ModuleDebugLineFragment()
> -    : ModuleDebugFragment(ModuleDebugFragmentKind::Lines) {}
> +ModuleDebugLineFragment::ModuleDebugLineFragment(
> +    ModuleDebugFileChecksumFragment &Checksums, StringTable &Strings)
> +    : ModuleDebugFragment(ModuleDebugFragmentKind::Lines),
> Checksums(Checksums),
> +      Strings(Strings) {}
>
> -void ModuleDebugLineFragment::createBlock(uint32_t ChecksumBufferOffset)
> {
> -  Blocks.emplace_back(ChecksumBufferOffset);
> +void ModuleDebugLineFragment::createBlock(StringRef FileName) {
> +  uint32_t Offset = Checksums.mapChecksumOffset(FileName);
> +
> +  Blocks.emplace_back(Offset);
>  }
>
>  void ModuleDebugLineFragment::addLineInfo(uint32_t Offset,
>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/StringTable.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> DebugInfo/CodeView/StringTable.cpp?rev=302053&r1=
> 302052&r2=302053&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/DebugInfo/CodeView/StringTable.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/CodeView/StringTable.cpp Wed May  3 12:11:40
> 2017
> @@ -63,3 +63,9 @@ Error StringTable::commit(BinaryStreamWr
>  }
>
>  uint32_t StringTable::size() const { return Strings.size(); }
> +
> +uint32_t StringTable::getStringId(StringRef S) const {
> +  auto P = Strings.find(S);
> +  assert(P != Strings.end());
> +  return P->second;
> +}
>
> Modified: llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-
> pdbdump/llvm-pdbdump.cpp?rev=302053&r1=302052&r2=302053&view=diff
> ============================================================
> ==================
> --- llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp (original)
> +++ llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp Wed May  3 12:11:40
> 2017
> @@ -424,21 +424,6 @@ cl::list<std::string> InputFilename(cl::
>
>  static ExitOnError ExitOnErr;
>
> -static uint32_t
> -getFileChecksumOffset(StringRef FileName,
> -                      ModuleDebugFileChecksumFragment &Checksums,
> -                      PDBStringTableBuilder &Strings) {
> -  // The offset in the line info record is the offset of the checksum
> -  // entry for the corresponding file.  That entry then contains an
> -  // offset into the global string table of the file name.  So to
> -  // compute the proper offset to write into the line info record, we
> -  // must first get its offset in the global string table, then ask the
> -  // checksum builder to find the offset in its serialized buffer that
> -  // it mapped that filename string table offset to.
> -  uint32_t StringOffset = Strings.insert(FileName);
> -  return Checksums.mapChecksumOffset(StringOffset);
> -}
> -
>  static void yamlToPdb(StringRef Path) {
>    BumpPtrAllocator Allocator;
>    ErrorOr<std::unique_ptr<MemoryBuffer>> ErrorOrBuffer =
> @@ -490,6 +475,8 @@ static void yamlToPdb(StringRef Path) {
>    for (auto F : Info.Features)
>      InfoBuilder.addFeature(F);
>
> +  auto &Strings = Builder.getStringTableBuilder().getStrings();
> +
>    const auto &Dbi = YamlObj.DbiStream.getValueOr(DefaultDbiStream);
>    auto &DbiBuilder = Builder.getDbiBuilder();
>    DbiBuilder.setAge(Dbi.Age);
> @@ -516,35 +503,24 @@ static void yamlToPdb(StringRef Path) {
>        // File Checksums must be emitted before line information, because
> line
>        // info records use offsets into the checksum buffer to reference a
> file's
>        // source file name.
> -      auto Checksums = llvm::make_unique<ModuleDebugFileChecksumFragmen
> t>();
> +      auto Checksums =
> +          llvm::make_unique<ModuleDebugFileChecksumFragment>(Strings);
>        auto &ChecksumRef = *Checksums;
>        if (!FLI.FileChecksums.empty()) {
> -        auto &Strings = Builder.getStringTableBuilder();
> -        for (auto &FC : FLI.FileChecksums) {
> -          uint32_t STOffset = Strings.insert(FC.FileName);
> -          Checksums->addChecksum(STOffset, FC.Kind,
> FC.ChecksumBytes.Bytes);
> -        }
> +        for (auto &FC : FLI.FileChecksums)
> +          Checksums->addChecksum(FC.FileName, FC.Kind,
> FC.ChecksumBytes.Bytes);
>        }
>        ModiBuilder.setC13FileChecksums(std::move(Checksums));
>
> -      // FIXME: StringTable / StringTableBuilder should really be in
> -      // DebugInfoCodeView.  This would allow us to construct the
> -      // ModuleDebugLineFragment with a reference to the string table,
> -      // and we could just pass strings around rather than having to
> -      // remember how to calculate the right offset.
> -      auto &Strings = Builder.getStringTableBuilder();
> -
>        for (const auto &Fragment : FLI.LineFragments) {
> -        auto Lines = llvm::make_unique<ModuleDebugLineFragment>();
> +        auto Lines =
> +            llvm::make_unique<ModuleDebugLineFragment>(ChecksumRef,
> Strings);
>          Lines->setCodeSize(Fragment.CodeSize);
>          Lines->setRelocationAddress(Fragment.RelocSegment,
>                                      Fragment.RelocOffset);
>          Lines->setFlags(Fragment.Flags);
>          for (const auto &LC : Fragment.Blocks) {
> -          uint32_t ChecksumOffset =
> -              getFileChecksumOffset(LC.FileName, ChecksumRef, Strings);
> -
> -          Lines->createBlock(ChecksumOffset);
> +          Lines->createBlock(LC.FileName);
>            if (Lines->hasColumnInfo()) {
>              for (const auto &Item : zip(LC.Lines, LC.Columns)) {
>                auto &L = std::get<0>(Item);
> @@ -567,18 +543,15 @@ static void yamlToPdb(StringRef Path) {
>
>        for (const auto &Inlinee : FLI.Inlinees) {
>          auto Inlinees = llvm::make_unique<ModuleDebugInlineeLineFragment
> >(
> -            Inlinee.HasExtraFiles);
> +            ChecksumRef, Strings, Inlinee.HasExtraFiles);
>          for (const auto &Site : Inlinee.Sites) {
> -          uint32_t FileOff =
> -              getFileChecksumOffset(Site.FileName, ChecksumRef, Strings);
> -
> -          Inlinees->addInlineSite(Site.Inlinee, FileOff,
> Site.SourceLineNum);
> +          Inlinees->addInlineSite(Site.Inlinee, Site.FileName,
> +                                  Site.SourceLineNum);
>            if (!Inlinee.HasExtraFiles)
>              continue;
>
>            for (auto EF : Site.ExtraFiles) {
> -            FileOff = getFileChecksumOffset(EF, ChecksumRef, Strings);
> -            Inlinees->addExtraFile(FileOff);
> +            Inlinees->addExtraFile(EF);
>            }
>          }
>          ModiBuilder.addC13Fragment(std::move(Inlinees));
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170503/fe314907/attachment.html>


More information about the llvm-commits mailing list