<div>Gah, 30 seconds after i left.  I won't be able to look at this until tomorrow unfortunately </div><div><br><div class="gmail_quote"><div>On Tue, May 2, 2017 at 6:10 PM Evgenii Stepanov <<a href="mailto:eugeni.stepanov@gmail.com" target="_blank">eugeni.stepanov@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
ASan claims a use-after-return caused by this change:<br>
<a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/4636/steps/check-llvm%20asan/logs/stdio" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/4636/steps/check-llvm%20asan/logs/stdio</a><br>
<br>
READ of size 4 at 0x7fd4a3a03d8c thread T0<br>
    #0 0x6f26b4 in hasExtraFiles<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp:53:10<br>
    #1 0x6f26b4 in<br>
llvm::VarStreamArrayExtractor<llvm::codeview::InlineeSourceLine>::extract(llvm::BinaryStreamRef,<br>
unsigned int&, llvm::codeview::InlineeSourceLine&,<br>
llvm::codeview::ModuleDebugInlineeLineFragmentRef*)<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp:26<br>
    #2 0x6430f4 in<br>
llvm::VarStreamArrayIterator<llvm::codeview::InlineeSourceLine,<br>
llvm::VarStreamArrayExtractor<llvm::codeview::InlineeSourceLine><br>
>::VarStreamArrayIterator(llvm::VarStreamArray<llvm::codeview::InlineeSourceLine,<br>
llvm::VarStreamArrayExtractor<llvm::codeview::InlineeSourceLine> ><br>
const&, llvm::codeview::ModuleDebugInlineeLineFragmentRef*,<br>
llvm::BinaryStreamRef, bool*)<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Support/BinaryStreamArray.h:137:17<br>
    #3 0x63ed91 in VarStreamArrayIterator<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Support/BinaryStreamArray.h:147:9<br>
    #4 0x63ed91 in begin<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Support/BinaryStreamArray.h:99<br>
    #5 0x63ed91 in begin<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h:67<br>
    #6 0x63ed91 in (anonymous<br>
namespace)::C13RawVisitor::handleInlineeLines()<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp:157<br>
    #7 0x591ac0 in llvm::pdb::C13DebugFragmentVisitor::finished()<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-pdbdump/C13DebugFragmentVisitor.cpp:62:17<br>
    #8 0x638308 in llvm::Error<br>
llvm::codeview::visitModuleDebugFragments<llvm::iterator_range<llvm::VarStreamArrayIterator<llvm::codeview::ModuleDebugFragmentRecord,<br>
llvm::VarStreamArrayExtractor<llvm::codeview::ModuleDebugFragmentRecord><br>
> > >(llvm::iterator_range<llvm::VarStreamArrayIterator<llvm::codeview::ModuleDebugFragmentRecord,<br>
llvm::VarStreamArrayExtractor<llvm::codeview::ModuleDebugFragmentRecord><br>
> >&&, llvm::codeview::ModuleDebugFragmentVisitor&)<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h:59:19<br>
    #9 0x62923e in llvm::pdb::LLVMOutputStyle::dumpDbiStream()<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp:806:25<br>
    #10 0x619926 in llvm::pdb::LLVMOutputStyle::dump()<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp:256:17<br>
    #11 0x5c0b50 in dumpRaw<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp:627:16<br>
    #12 0x5c0b50 in<br>
for_each<std::__1::__wrap_iter<std::__1::basic_string<char> *>, void<br>
(*)(llvm::StringRef)><br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/libcxx_build_asan/include/c++/v1/algorithm:879<br>
    #13 0x5c0b50 in main<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp:881<br>
    #14 0x7fd4a69ad82f in __libc_start_main<br>
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)<br>
    #15 0x47d2f8 in _start<br>
(/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/llvm-pdbdump+0x47d2f8)<br>
<br>
Address 0x7fd4a3a03d8c is located in stack of thread T0 at offset 396 in frame<br>
    #0 0x6f194f in<br>
llvm::codeview::visitModuleDebugFragment(llvm::codeview::ModuleDebugFragmentRecord<br>
const&, llvm::codeview::ModuleDebugFragmentVisitor&)<br>
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp:24<br>
<br>
  This frame has 8 object(s):<br>
    [32, 64) 'Reader:25'<br>
    [96, 144) 'Fragment:28'<br>
    [176, 208) 'agg.tmp2'<br>
    [240, 280) 'Fragment7:35'<br>
    [320, 352) 'agg.tmp9'<br>
    [384, 424) 'Fragment24:42' <== Memory access at offset 396 is<br>
inside this variable<br>
    [464, 496) 'agg.tmp26'<br>
    [528, 560) 'Fragment40:48'<br>
<br>
On Tue, May 2, 2017 at 9:56 AM, Zachary Turner via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
> Author: zturner<br>
> Date: Tue May  2 11:56:09 2017<br>
> New Revision: 301936<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=301936&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=301936&view=rev</a><br>
> Log:<br>
> [PDB/CodeView] Read/write codeview inlinee line information.<br>
><br>
> Previously we wrote line information and file checksum<br>
> information, but we did not write information about inlinee<br>
> lines and functions.  This patch adds support for that.<br>
><br>
> Added:<br>
>     llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h<br>
>     llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp<br>
> Modified:<br>
>     llvm/trunk/include/llvm/DebugInfo/CodeView/Line.h<br>
>     llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h<br>
>     llvm/trunk/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h<br>
>     llvm/trunk/include/llvm/Support/BinaryStreamWriter.h<br>
>     llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp<br>
>     llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt<br>
>     llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp<br>
>     llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFragmentRecord.cpp<br>
>     llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp<br>
>     llvm/trunk/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp<br>
>     llvm/trunk/test/DebugInfo/PDB/Inputs/simple-line-info.yaml<br>
>     llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-lineinfo-write.test<br>
>     llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.cpp<br>
>     llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.h<br>
>     llvm/trunk/tools/llvm-pdbdump/CompactTypeDumpVisitor.cpp<br>
>     llvm/trunk/tools/llvm-pdbdump/CompactTypeDumpVisitor.h<br>
>     llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.cpp<br>
>     llvm/trunk/tools/llvm-pdbdump/PdbYaml.cpp<br>
>     llvm/trunk/tools/llvm-pdbdump/PdbYaml.h<br>
>     llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.cpp<br>
>     llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp<br>
>     llvm/trunk/tools/llvm-readobj/COFFDumper.cpp<br>
><br>
> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/Line.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/Line.h?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/Line.h?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/DebugInfo/CodeView/Line.h (original)<br>
> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/Line.h Tue May  2 11:56:09 2017<br>
> @@ -127,20 +127,6 @@ public:<br>
>    bool isNeverStepInto() const { return LineInf.isNeverStepInto(); }<br>
>  };<br>
><br>
> -enum class InlineeLinesSignature : uint32_t {<br>
> -  Normal,    // CV_INLINEE_SOURCE_LINE_SIGNATURE<br>
> -  ExtraFiles // CV_INLINEE_SOURCE_LINE_SIGNATURE_EX<br>
> -};<br>
> -<br>
> -struct InlineeSourceLine {<br>
> -  TypeIndex Inlinee;         // ID of the function that was inlined.<br>
> -  ulittle32_t FileID;        // Offset into FileChecksums subsection.<br>
> -  ulittle32_t SourceLineNum; // First line of inlined code.<br>
> -  // If extra files present:<br>
> -  //   ulittle32_t ExtraFileCount;<br>
> -  //   ulittle32_t Files[];<br>
> -};<br>
> -<br>
>  } // namespace codeview<br>
>  } // namespace llvm<br>
><br>
><br>
> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h (original)<br>
> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h Tue May  2 11:56:09 2017<br>
> @@ -39,6 +39,10 @@ public:<br>
>      return Error::success();<br>
>    }<br>
><br>
> +  virtual Error visitInlineeLines(ModuleDebugInlineeLineFragmentRef &Inlinees) {<br>
> +    return Error::success();<br>
> +  }<br>
> +<br>
>    virtual Error finished() { return Error::success(); }<br>
>  };<br>
><br>
><br>
> Added: llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h?rev=301936&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h?rev=301936&view=auto</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h (added)<br>
> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h Tue May  2 11:56:09 2017<br>
> @@ -0,0 +1,103 @@<br>
> +//===- ModuleDebugInlineeLinesFragment.h ------------------------*- C++ -*-===//<br>
> +//<br>
> +//                     The LLVM Compiler Infrastructure<br>
> +//<br>
> +// This file is distributed under the University of Illinois Open Source<br>
> +// License. See LICENSE.TXT for details.<br>
> +//<br>
> +//===----------------------------------------------------------------------===//<br>
> +<br>
> +#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGINLINEELINESFRAGMENT_H<br>
> +#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGINLINEELINESFRAGMENT_H<br>
> +<br>
> +#include "llvm/DebugInfo/CodeView/Line.h"<br>
> +#include "llvm/DebugInfo/CodeView/ModuleDebugFragment.h"<br>
> +#include "llvm/Support/BinaryStreamArray.h"<br>
> +#include "llvm/Support/BinaryStreamReader.h"<br>
> +#include "llvm/Support/Error.h"<br>
> +<br>
> +namespace llvm {<br>
> +namespace codeview {<br>
> +<br>
> +class ModuleDebugInlineeLineFragmentRef;<br>
> +<br>
> +enum class InlineeLinesSignature : uint32_t {<br>
> +  Normal,    // CV_INLINEE_SOURCE_LINE_SIGNATURE<br>
> +  ExtraFiles // CV_INLINEE_SOURCE_LINE_SIGNATURE_EX<br>
> +};<br>
> +<br>
> +struct InlineeSourceLineHeader {<br>
> +  TypeIndex Inlinee;                  // ID of the function that was inlined.<br>
> +  support::ulittle32_t FileID;        // Offset into FileChecksums subsection.<br>
> +  support::ulittle32_t SourceLineNum; // First line of inlined code.<br>
> +                                      // If extra files present:<br>
> +                                      //   ulittle32_t ExtraFileCount;<br>
> +                                      //   ulittle32_t Files[];<br>
> +};<br>
> +<br>
> +struct InlineeSourceLine {<br>
> +  const InlineeSourceLineHeader *Header;<br>
> +  FixedStreamArray<support::ulittle32_t> ExtraFiles;<br>
> +};<br>
> +}<br>
> +<br>
> +template <> struct VarStreamArrayExtractor<codeview::InlineeSourceLine> {<br>
> +  typedef codeview::ModuleDebugInlineeLineFragmentRef ContextType;<br>
> +<br>
> +  static Error extract(BinaryStreamRef Stream, uint32_t &Len,<br>
> +                       codeview::InlineeSourceLine &Item,<br>
> +                       ContextType *Fragment);<br>
> +};<br>
> +<br>
> +namespace codeview {<br>
> +class ModuleDebugInlineeLineFragmentRef final : public ModuleDebugFragmentRef {<br>
> +  typedef VarStreamArray<InlineeSourceLine> LinesArray;<br>
> +  typedef LinesArray::Iterator Iterator;<br>
> +<br>
> +public:<br>
> +  ModuleDebugInlineeLineFragmentRef();<br>
> +<br>
> +  static bool classof(const ModuleDebugFragmentRef *S) {<br>
> +    return S->kind() == ModuleDebugFragmentKind::InlineeLines;<br>
> +  }<br>
> +<br>
> +  Error initialize(BinaryStreamReader Reader);<br>
> +  bool hasExtraFiles() const;<br>
> +<br>
> +  Iterator begin() const { return Lines.begin(); }<br>
> +  Iterator end() const { return Lines.end(); }<br>
> +<br>
> +private:<br>
> +  InlineeLinesSignature Signature;<br>
> +  VarStreamArray<InlineeSourceLine> Lines;<br>
> +};<br>
> +<br>
> +class ModuleDebugInlineeLineFragment final : public ModuleDebugFragment {<br>
> +public:<br>
> +  explicit ModuleDebugInlineeLineFragment(bool HasExtraFiles);<br>
> +<br>
> +  static bool classof(const ModuleDebugFragment *S) {<br>
> +    return S->kind() == ModuleDebugFragmentKind::InlineeLines;<br>
> +  }<br>
> +<br>
> +  Error commit(BinaryStreamWriter &Writer) override;<br>
> +  uint32_t calculateSerializedLength() override;<br>
> +<br>
> +  void addInlineSite(TypeIndex FuncId, uint32_t FileOffset,<br>
> +                     uint32_t SourceLine);<br>
> +  void addExtraFile(uint32_t FileOffset);<br>
> +<br>
> +private:<br>
> +  bool HasExtraFiles = false;<br>
> +  uint32_t ExtraFileCount = 0;<br>
> +<br>
> +  struct Entry {<br>
> +    std::vector<support::ulittle32_t> ExtraFiles;<br>
> +    InlineeSourceLineHeader Header;<br>
> +  };<br>
> +  std::vector<Entry> Entries;<br>
> +};<br>
> +}<br>
> +}<br>
> +<br>
> +#endif<br>
><br>
> Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h (original)<br>
> +++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h Tue May  2 11:56:09 2017<br>
> @@ -12,6 +12,7 @@<br>
><br>
>  #include "llvm/ADT/StringRef.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"<br>
> +#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/SymbolRecord.h"<br>
>  #include "llvm/DebugInfo/PDB/Native/RawTypes.h"<br>
> @@ -48,8 +49,9 @@ public:<br>
>    void setObjFileName(StringRef Name);<br>
>    void addSymbol(codeview::CVSymbol Symbol);<br>
><br>
> -  void<br>
> -  addC13LineFragment(std::unique_ptr<codeview::ModuleDebugLineFragment> Lines);<br>
> +  void addC13Fragment(std::unique_ptr<codeview::ModuleDebugLineFragment> Lines);<br>
> +  void addC13Fragment(<br>
> +      std::unique_ptr<codeview::ModuleDebugInlineeLineFragment> Inlinees);<br>
>    void setC13FileChecksums(<br>
>        std::unique_ptr<codeview::ModuleDebugFileChecksumFragment> Checksums);<br>
><br>
> @@ -80,8 +82,11 @@ private:<br>
>    std::string ObjFileName;<br>
>    std::vector<std::string> SourceFiles;<br>
>    std::vector<codeview::CVSymbol> Symbols;<br>
> -  std::vector<std::unique_ptr<codeview::ModuleDebugLineFragment>> LineInfo;<br>
> +<br>
>    std::unique_ptr<codeview::ModuleDebugFileChecksumFragment> ChecksumInfo;<br>
> +  std::vector<std::unique_ptr<codeview::ModuleDebugLineFragment>> LineInfo;<br>
> +  std::vector<std::unique_ptr<codeview::ModuleDebugInlineeLineFragment>><br>
> +      Inlinees;<br>
><br>
>    std::vector<std::unique_ptr<codeview::ModuleDebugFragmentRecordBuilder>><br>
>        C13Builders;<br>
><br>
> Modified: llvm/trunk/include/llvm/Support/BinaryStreamWriter.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/BinaryStreamWriter.h?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/BinaryStreamWriter.h?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/Support/BinaryStreamWriter.h (original)<br>
> +++ llvm/trunk/include/llvm/Support/BinaryStreamWriter.h Tue May  2 11:56:09 2017<br>
> @@ -30,6 +30,8 @@ namespace llvm {<br>
>  /// although no methods are overridable.<br>
>  class BinaryStreamWriter {<br>
>  public:<br>
> +  // FIXME: We should be able to slice and drop_front etc on Writers / Readers.<br>
> +<br>
>    BinaryStreamWriter() = default;<br>
>    explicit BinaryStreamWriter(WritableBinaryStreamRef Stream);<br>
>    virtual ~BinaryStreamWriter() {}<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Tue May  2 11:56:09 2017<br>
> @@ -17,6 +17,7 @@<br>
>  #include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"<br>
>  #include "llvm/DebugInfo/CodeView/CodeView.h"<br>
>  #include "llvm/DebugInfo/CodeView/Line.h"<br>
> +#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/SymbolRecord.h"<br>
>  #include "llvm/DebugInfo/CodeView/TypeDatabase.h"<br>
>  #include "llvm/DebugInfo/CodeView/TypeDumpVisitor.h"<br>
><br>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt (original)<br>
> +++ llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt Tue May  2 11:56:09 2017<br>
> @@ -11,6 +11,7 @@ add_llvm_library(LLVMDebugInfoCodeView<br>
>    ModuleDebugFragment.cpp<br>
>    ModuleDebugFragmentRecord.cpp<br>
>    ModuleDebugFragmentVisitor.cpp<br>
> +  ModuleDebugInlineeLinesFragment.cpp<br>
>    ModuleDebugLineFragment.cpp<br>
>    ModuleDebugUnknownFragment.cpp<br>
>    RecordSerialization.cpp<br>
><br>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp (original)<br>
> +++ llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp Tue May  2 11:56:09 2017<br>
> @@ -68,7 +68,10 @@ void ModuleDebugFileChecksumFragment::ad<br>
>    // This maps the offset of this string in the string table to the offset<br>
>    // of this checksum entry in the checksum buffer.<br>
>    OffsetMap[StringTableOffset] = SerializedSize;<br>
> -  SerializedSize += sizeof(FileChecksumEntryHeader) + Bytes.size();<br>
> +  assert(SerializedSize % 4 == 0);<br>
> +<br>
> +  uint32_t Len = alignTo(sizeof(FileChecksumEntryHeader) + Bytes.size(), 4);<br>
> +  SerializedSize += Len;<br>
>  }<br>
><br>
>  uint32_t ModuleDebugFileChecksumFragment::calculateSerializedLength() {<br>
> @@ -85,6 +88,8 @@ Error ModuleDebugFileChecksumFragment::c<br>
>        return EC;<br>
>      if (auto EC = Writer.writeArray(makeArrayRef(FC.Checksum)))<br>
>        return EC;<br>
> +    if (auto EC = Writer.padToAlignment(4))<br>
> +      return EC;<br>
>    }<br>
>    return Error::success();<br>
>  }<br>
><br>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFragmentRecord.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFragmentRecord.cpp?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFragmentRecord.cpp?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFragmentRecord.cpp (original)<br>
> +++ llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFragmentRecord.cpp Tue May  2 11:56:09 2017<br>
> @@ -34,6 +34,7 @@ Error ModuleDebugFragmentRecord::initial<br>
>    switch (Kind) {<br>
>    case ModuleDebugFragmentKind::FileChecksums:<br>
>    case ModuleDebugFragmentKind::Lines:<br>
> +  case ModuleDebugFragmentKind::InlineeLines:<br>
>      break;<br>
>    default:<br>
>      llvm_unreachable("Unexpected debug fragment kind!");<br>
><br>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp (original)<br>
> +++ llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp Tue May  2 11:56:09 2017<br>
> @@ -11,6 +11,7 @@<br>
><br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugFragmentRecord.h"<br>
> +#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugUnknownFragment.h"<br>
>  #include "llvm/Support/BinaryStreamReader.h"<br>
> @@ -37,6 +38,12 @@ Error llvm::codeview::visitModuleDebugFr<br>
><br>
>      return V.visitFileChecksums(Fragment);<br>
>    }<br>
> +  case ModuleDebugFragmentKind::InlineeLines: {<br>
> +    ModuleDebugInlineeLineFragmentRef Fragment;<br>
> +    if (auto EC = Fragment.initialize(Reader))<br>
> +      return EC;<br>
> +    return V.visitInlineeLines(Fragment);<br>
> +  }<br>
>    default: {<br>
>      ModuleDebugUnknownFragmentRef Fragment(R.kind(), R.getRecordData());<br>
>      return V.visitUnknown(Fragment);<br>
><br>
> Added: llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp?rev=301936&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp?rev=301936&view=auto</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp (added)<br>
> +++ llvm/trunk/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp Tue May  2 11:56:09 2017<br>
> @@ -0,0 +1,116 @@<br>
> +//===- ModuleDebugInlineeLineFragment.cpp ------------------------*- C++-*-===//<br>
> +//<br>
> +//                     The LLVM Compiler Infrastructure<br>
> +//<br>
> +// This file is distributed under the University of Illinois Open Source<br>
> +// License. See LICENSE.TXT for details.<br>
> +//<br>
> +//===----------------------------------------------------------------------===//<br>
> +<br>
> +#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"<br>
> +<br>
> +#include "llvm/DebugInfo/CodeView/CodeViewError.h"<br>
> +#include "llvm/DebugInfo/CodeView/ModuleDebugFragmentRecord.h"<br>
> +<br>
> +using namespace llvm;<br>
> +using namespace llvm::codeview;<br>
> +<br>
> +Error VarStreamArrayExtractor<InlineeSourceLine>::extract(<br>
> +    BinaryStreamRef Stream, uint32_t &Len, InlineeSourceLine &Item,<br>
> +    ContextType *Fragment) {<br>
> +  BinaryStreamReader Reader(Stream);<br>
> +<br>
> +  if (auto EC = Reader.readObject(Item.Header))<br>
> +    return EC;<br>
> +<br>
> +  if (Fragment->hasExtraFiles()) {<br>
> +    uint32_t ExtraFileCount;<br>
> +    if (auto EC = Reader.readInteger(ExtraFileCount))<br>
> +      return EC;<br>
> +    if (auto EC = Reader.readArray(Item.ExtraFiles, ExtraFileCount))<br>
> +      return EC;<br>
> +  }<br>
> +<br>
> +  Len = Reader.getOffset();<br>
> +  return Error::success();<br>
> +}<br>
> +<br>
> +ModuleDebugInlineeLineFragmentRef::ModuleDebugInlineeLineFragmentRef()<br>
> +    : ModuleDebugFragmentRef(ModuleDebugFragmentKind::InlineeLines) {}<br>
> +<br>
> +Error ModuleDebugInlineeLineFragmentRef::initialize(BinaryStreamReader Reader) {<br>
> +  if (auto EC = Reader.readEnum(Signature))<br>
> +    return EC;<br>
> +<br>
> +  if (auto EC = Reader.readArray(Lines, Reader.bytesRemaining(), this))<br>
> +    return EC;<br>
> +<br>
> +  assert(Reader.bytesRemaining() == 0);<br>
> +  return Error::success();<br>
> +}<br>
> +<br>
> +bool ModuleDebugInlineeLineFragmentRef::hasExtraFiles() const {<br>
> +  return Signature == InlineeLinesSignature::ExtraFiles;<br>
> +}<br>
> +<br>
> +ModuleDebugInlineeLineFragment::ModuleDebugInlineeLineFragment(<br>
> +    bool HasExtraFiles)<br>
> +    : ModuleDebugFragment(ModuleDebugFragmentKind::InlineeLines),<br>
> +      HasExtraFiles(HasExtraFiles) {}<br>
> +<br>
> +uint32_t ModuleDebugInlineeLineFragment::calculateSerializedLength() {<br>
> +  // 4 bytes for the signature<br>
> +  uint32_t Size = sizeof(InlineeLinesSignature);<br>
> +<br>
> +  // one header for each entry.<br>
> +  Size += Entries.size() * sizeof(InlineeSourceLineHeader);<br>
> +  if (HasExtraFiles) {<br>
> +    // If extra files are enabled, one count for each entry.<br>
> +    Size += Entries.size() * sizeof(uint32_t);<br>
> +<br>
> +    // And one file id for each file.<br>
> +    Size += ExtraFileCount * sizeof(uint32_t);<br>
> +  }<br>
> +  assert(Size % 4 == 0);<br>
> +  return Size;<br>
> +}<br>
> +<br>
> +Error ModuleDebugInlineeLineFragment::commit(BinaryStreamWriter &Writer) {<br>
> +  InlineeLinesSignature Sig = InlineeLinesSignature::Normal;<br>
> +  if (HasExtraFiles)<br>
> +    Sig = InlineeLinesSignature::ExtraFiles;<br>
> +<br>
> +  if (auto EC = Writer.writeEnum(Sig))<br>
> +    return EC;<br>
> +<br>
> +  for (const auto &E : Entries) {<br>
> +    if (auto EC = Writer.writeObject(E.Header))<br>
> +      return EC;<br>
> +<br>
> +    if (!HasExtraFiles)<br>
> +      continue;<br>
> +<br>
> +    if (auto EC = Writer.writeInteger<uint32_t>(E.ExtraFiles.size()))<br>
> +      return EC;<br>
> +    if (auto EC = Writer.writeArray(makeArrayRef(E.ExtraFiles)))<br>
> +      return EC;<br>
> +  }<br>
> +<br>
> +  return Error::success();<br>
> +}<br>
> +<br>
> +void ModuleDebugInlineeLineFragment::addExtraFile(uint32_t FileOffset) {<br>
> +  auto &Entry = Entries.back();<br>
> +  Entry.ExtraFiles.push_back(ulittle32_t(FileOffset));<br>
> +  ++ExtraFileCount;<br>
> +}<br>
> +<br>
> +void ModuleDebugInlineeLineFragment::addInlineSite(TypeIndex FuncId,<br>
> +                                                   uint32_t FileOffset,<br>
> +                                                   uint32_t SourceLine) {<br>
> +  Entries.emplace_back();<br>
> +  auto &Entry = Entries.back();<br>
> +  Entry.Header.FileID = FileOffset;<br>
> +  Entry.Header.SourceLineNum = SourceLine;<br>
> +  Entry.Header.Inlinee = FuncId;<br>
> +}<br>
><br>
> Modified: llvm/trunk/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp (original)<br>
> +++ llvm/trunk/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp Tue May  2 11:56:09 2017<br>
> @@ -161,7 +161,7 @@ Error DbiModuleDescriptorBuilder::commit<br>
>    return Error::success();<br>
>  }<br>
><br>
> -void DbiModuleDescriptorBuilder::addC13LineFragment(<br>
> +void DbiModuleDescriptorBuilder::addC13Fragment(<br>
>      std::unique_ptr<ModuleDebugLineFragment> Lines) {<br>
>    ModuleDebugLineFragment &Frag = *Lines;<br>
><br>
> @@ -174,6 +174,20 @@ void DbiModuleDescriptorBuilder::addC13L<br>
>    C13Builders.push_back(<br>
>        llvm::make_unique<ModuleDebugFragmentRecordBuilder>(Frag.kind(), Frag));<br>
>  }<br>
> +<br>
> +void DbiModuleDescriptorBuilder::addC13Fragment(<br>
> +    std::unique_ptr<codeview::ModuleDebugInlineeLineFragment> Inlinees) {<br>
> +  ModuleDebugInlineeLineFragment &Frag = *Inlinees;<br>
> +<br>
> +  // File Checksums have to come first, so push an empty entry on if this<br>
> +  // is the first.<br>
> +  if (C13Builders.empty())<br>
> +    C13Builders.push_back(nullptr);<br>
> +<br>
> +  this->Inlinees.push_back(std::move(Inlinees));<br>
> +  C13Builders.push_back(<br>
> +      llvm::make_unique<ModuleDebugFragmentRecordBuilder>(Frag.kind(), Frag));<br>
> +}<br>
><br>
>  void DbiModuleDescriptorBuilder::setC13FileChecksums(<br>
>      std::unique_ptr<ModuleDebugFileChecksumFragment> Checksums) {<br>
><br>
> Modified: llvm/trunk/test/DebugInfo/PDB/Inputs/simple-line-info.yaml<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/Inputs/simple-line-info.yaml?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/Inputs/simple-line-info.yaml?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/DebugInfo/PDB/Inputs/simple-line-info.yaml (original)<br>
> +++ llvm/trunk/test/DebugInfo/PDB/Inputs/simple-line-info.yaml Tue May  2 11:56:09 2017<br>
> @@ -1,8 +1,4 @@<br>
>  ---<br>
> -StringTable:<br>
> -  - 'junk_a'<br>
> -  - 'd:\src\llvm\test\debuginfo\pdb\inputs\empty.cpp'<br>
> -  - 'junk_b'<br>
>  DbiStream:<br>
>    Modules:<br>
>      - Module:          'd:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj'<br>
> @@ -14,6 +10,9 @@ DbiStream:<br>
>            - FileName:        'd:\src\llvm\test\debuginfo\pdb\inputs\empty.cpp'<br>
>              Kind:            MD5<br>
>              Checksum:        A0A5BD0D3ECD93FC29D19DE826FBF4BC<br>
> +          - FileName:        'f:\dd\externalapis\windows\10\sdk\inc\winerror.h'<br>
> +            Kind:            MD5<br>
> +            Checksum:        1154D69F5B2650196E1FC34F4134E56B<br>
>          Lines:<br>
>            - CodeSize:        10<br>
>              Flags:           [  ]<br>
> @@ -35,4 +34,10 @@ DbiStream:<br>
>                      IsStatement:     true<br>
>                      EndDelta:        0<br>
>                  Columns:<br>
> +        InlineeLines:<br>
> +          - HasExtraFiles:   false<br>
> +            Sites:<br>
> +              - FileName:        'f:\dd\externalapis\windows\10\sdk\inc\winerror.h'<br>
> +                LineNum:         26950<br>
> +                Inlinee:         22767<br>
>  ...<br>
><br>
> Modified: llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-lineinfo-write.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-lineinfo-write.test?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-lineinfo-write.test?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-lineinfo-write.test (original)<br>
> +++ llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-lineinfo-write.test Tue May  2 11:56:09 2017<br>
> @@ -18,6 +18,13 @@ LINES-NEXT:            Checksum (<br>
>  LINES-NEXT:              0000: A0A5BD0D 3ECD93FC 29D19DE8 26FBF4BC  |....>...)...&...|<br>
>  LINES-NEXT:            )<br>
>  LINES-NEXT:          }<br>
> +LINES-NEXT:          Checksum {<br>
> +LINES-NEXT:            FileName: f:\dd\externalapis\windows\10\sdk\inc\winerror.h<br>
> +LINES-NEXT:            Kind: MD5 (0x1)<br>
> +LINES-NEXT:            Checksum (<br>
> +LINES-NEXT:              0000: 1154D69F 5B265019 6E1FC34F 4134E56B  |.T..[&P.n..OA4.k|<br>
> +LINES-NEXT:            )<br>
> +LINES-NEXT:          }<br>
>  LINES-NEXT:        }<br>
>  LINES-NEXT:        Lines {<br>
>  LINES-NEXT:          Block {<br>
> @@ -48,5 +55,17 @@ LINES-NEXT:              }<br>
>  LINES-NEXT:            }<br>
>  LINES-NEXT:          }<br>
>  LINES-NEXT:        }<br>
> +LINES-NEXT:        InlineeLines {<br>
> +LINES-NEXT:          HasExtraFiles: No<br>
> +LINES-NEXT:          Lines [<br>
> +LINES-NEXT:            Inlinee {<br>
> +LINES-NEXT:              FileName: f:\dd\externalapis\windows\10\sdk\inc\winerror.h<br>
> +LINES-NEXT:              Function {<br>
> +LINES-NEXT:                Index: 0x58ef (unknown function)<br>
> +LINES-NEXT:              }<br>
> +LINES-NEXT:              SourceLine: 26950<br>
> +LINES-NEXT:            }<br>
> +LINES-NEXT:          ]<br>
> +LINES-NEXT:        }<br>
>  LINES-NEXT:      ]<br>
>  LINES-NEXT:    }<br>
><br>
> Modified: llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.cpp?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.cpp?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.cpp (original)<br>
> +++ llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.cpp Tue May  2 11:56:09 2017<br>
> @@ -10,6 +10,7 @@<br>
>  #include "C13DebugFragmentVisitor.h"<br>
><br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"<br>
> +#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h"<br>
>  #include "llvm/DebugInfo/PDB/Native/PDBFile.h"<br>
>  #include "llvm/DebugInfo/PDB/Native/RawError.h"<br>
> @@ -41,6 +42,12 @@ Error C13DebugFragmentVisitor::visitLine<br>
>    return Error::success();<br>
>  }<br>
><br>
> +Error C13DebugFragmentVisitor::visitInlineeLines(<br>
> +    codeview::ModuleDebugInlineeLineFragmentRef &Lines) {<br>
> +  this->InlineeLines.push_back(Lines);<br>
> +  return Error::success();<br>
> +}<br>
> +<br>
>  Error C13DebugFragmentVisitor::finished() {<br>
>    if (!Checksums.hasValue()) {<br>
>      assert(Lines.empty());<br>
> @@ -52,6 +59,9 @@ Error C13DebugFragmentVisitor::finished(<br>
>    if (auto EC = handleLines())<br>
>      return EC;<br>
><br>
> +  if (auto EC = handleInlineeLines())<br>
> +    return EC;<br>
> +<br>
>    return Error::success();<br>
>  }<br>
><br>
><br>
> Modified: llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.h?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.h?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.h (original)<br>
> +++ llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.h Tue May  2 11:56:09 2017<br>
> @@ -35,16 +35,21 @@ public:<br>
><br>
>    Error visitLines(codeview::ModuleDebugLineFragmentRef &Lines) final;<br>
><br>
> +  Error<br>
> +  visitInlineeLines(codeview::ModuleDebugInlineeLineFragmentRef &Lines) final;<br>
> +<br>
>    Error finished() final;<br>
><br>
>  protected:<br>
>    virtual Error handleFileChecksums() { return Error::success(); }<br>
>    virtual Error handleLines() { return Error::success(); }<br>
> +  virtual Error handleInlineeLines() { return Error::success(); }<br>
><br>
>    Expected<StringRef> getNameFromStringTable(uint32_t Offset);<br>
>    Expected<StringRef> getNameFromChecksumsBuffer(uint32_t Offset);<br>
><br>
>    Optional<codeview::ModuleDebugFileChecksumFragmentRef> Checksums;<br>
> +  std::vector<codeview::ModuleDebugInlineeLineFragmentRef> InlineeLines;<br>
>    std::vector<codeview::ModuleDebugLineFragmentRef> Lines;<br>
><br>
>    PDBFile &F;<br>
><br>
> Modified: llvm/trunk/tools/llvm-pdbdump/CompactTypeDumpVisitor.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/CompactTypeDumpVisitor.cpp?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/CompactTypeDumpVisitor.cpp?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-pdbdump/CompactTypeDumpVisitor.cpp (original)<br>
> +++ llvm/trunk/tools/llvm-pdbdump/CompactTypeDumpVisitor.cpp Tue May  2 11:56:09 2017<br>
> @@ -31,14 +31,15 @@ static StringRef getLeafName(TypeLeafKin<br>
><br>
>  CompactTypeDumpVisitor::CompactTypeDumpVisitor(TypeDatabase &TypeDB,<br>
>                                                 ScopedPrinter *W)<br>
> -    : W(W), TI(TypeIndex::None()), Offset(0), TypeDB(TypeDB) {}<br>
> +    : CompactTypeDumpVisitor(TypeDB, TypeIndex(TypeIndex::FirstNonSimpleIndex),<br>
> +                             W) {}<br>
><br>
> -Error CompactTypeDumpVisitor::visitTypeBegin(CVType &Record) {<br>
> -  if (TI == TypeIndex::None())<br>
> -    TI.setIndex(TypeIndex::FirstNonSimpleIndex);<br>
> -  else<br>
> -    TI.setIndex(TI.getIndex() + 1);<br>
> +CompactTypeDumpVisitor::CompactTypeDumpVisitor(TypeDatabase &TypeDB,<br>
> +                                               TypeIndex FirstTI,<br>
> +                                               ScopedPrinter *W)<br>
> +    : W(W), TI(FirstTI), Offset(0), TypeDB(TypeDB) {}<br>
><br>
> +Error CompactTypeDumpVisitor::visitTypeBegin(CVType &Record) {<br>
>    return Error::success();<br>
>  }<br>
><br>
> @@ -52,6 +53,7 @@ Error CompactTypeDumpVisitor::visitTypeE<br>
>            .str());<br>
><br>
>    Offset += Record.length();<br>
> +  TI.setIndex(TI.getIndex() + 1);<br>
><br>
>    return Error::success();<br>
>  }<br>
><br>
> Modified: llvm/trunk/tools/llvm-pdbdump/CompactTypeDumpVisitor.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/CompactTypeDumpVisitor.h?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/CompactTypeDumpVisitor.h?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-pdbdump/CompactTypeDumpVisitor.h (original)<br>
> +++ llvm/trunk/tools/llvm-pdbdump/CompactTypeDumpVisitor.h Tue May  2 11:56:09 2017<br>
> @@ -27,6 +27,8 @@ namespace pdb {<br>
>  class CompactTypeDumpVisitor : public codeview::TypeVisitorCallbacks {<br>
>  public:<br>
>    CompactTypeDumpVisitor(codeview::TypeDatabase &TypeDB, ScopedPrinter *W);<br>
> +  CompactTypeDumpVisitor(codeview::TypeDatabase &TypeDB,<br>
> +                         codeview::TypeIndex FirstTI, ScopedPrinter *W);<br>
><br>
>    /// Paired begin/end actions for all types. Receives all record data,<br>
>    /// including the fixed-length record prefix.<br>
><br>
> Modified: llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.cpp?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.cpp?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.cpp (original)<br>
> +++ llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.cpp Tue May  2 11:56:09 2017<br>
> @@ -20,6 +20,7 @@<br>
>  #include "llvm/DebugInfo/CodeView/Line.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h"<br>
> +#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugUnknownFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/SymbolDumper.h"<br>
> @@ -82,10 +83,13 @@ struct PageStats {<br>
><br>
>  class C13RawVisitor : public C13DebugFragmentVisitor {<br>
>  public:<br>
> -  C13RawVisitor(ScopedPrinter &P, PDBFile &F)<br>
> -      : C13DebugFragmentVisitor(F), P(P) {}<br>
> +  C13RawVisitor(ScopedPrinter &P, PDBFile &F, TypeDatabase &IPI)<br>
> +      : C13DebugFragmentVisitor(F), P(P), IPI(IPI) {}<br>
><br>
>    Error handleLines() override {<br>
> +    if (Lines.empty())<br>
> +      return Error::success();<br>
> +<br>
>      DictScope DD(P, "Lines");<br>
><br>
>      for (const auto &Fragment : Lines) {<br>
> @@ -126,6 +130,9 @@ public:<br>
>    }<br>
><br>
>    Error handleFileChecksums() override {<br>
> +    if (!Checksums.hasValue())<br>
> +      return Error::success();<br>
> +<br>
>      DictScope DD(P, "FileChecksums");<br>
>      for (const auto &CS : *Checksums) {<br>
>        DictScope DDD(P, "Checksum");<br>
> @@ -139,7 +146,50 @@ public:<br>
>      return Error::success();<br>
>    }<br>
><br>
> +  Error handleInlineeLines() override {<br>
> +    if (InlineeLines.empty())<br>
> +      return Error::success();<br>
> +<br>
> +    DictScope D(P, "InlineeLines");<br>
> +    for (const auto &IL : InlineeLines) {<br>
> +      P.printBoolean("HasExtraFiles", IL.hasExtraFiles());<br>
> +      ListScope LS(P, "Lines");<br>
> +      for (const auto &L : IL) {<br>
> +        DictScope DDD(P, "Inlinee");<br>
> +        if (auto EC = printFileName("FileName", L.Header->FileID))<br>
> +          return EC;<br>
> +<br>
> +        if (auto EC = dumpTypeRecord("Function", IPI, L.Header->Inlinee))<br>
> +          return EC;<br>
> +        P.printNumber("SourceLine", L.Header->SourceLineNum);<br>
> +        if (IL.hasExtraFiles()) {<br>
> +          ListScope DDDD(P, "ExtraFiles");<br>
> +          for (const auto &EF : L.ExtraFiles) {<br>
> +            if (auto EC = printFileName("File", EF))<br>
> +              return EC;<br>
> +          }<br>
> +        }<br>
> +      }<br>
> +    }<br>
> +    return Error::success();<br>
> +  }<br>
> +<br>
>  private:<br>
> +  Error dumpTypeRecord(StringRef Label, TypeDatabase &DB, TypeIndex Index) {<br>
> +    CompactTypeDumpVisitor CTDV(DB, Index, &P);<br>
> +    CVTypeVisitor Visitor(CTDV);<br>
> +    DictScope D(P, Label);<br>
> +    if (DB.containsTypeIndex(Index)) {<br>
> +      CVType &Type = DB.getTypeRecord(Index);<br>
> +      if (auto EC = Visitor.visitTypeRecord(Type))<br>
> +        return EC;<br>
> +    } else {<br>
> +      P.printString(<br>
> +          llvm::formatv("Index: {0:x} (unknown function)", Index.getIndex())<br>
> +              .str());<br>
> +    }<br>
> +    return Error::success();<br>
> +  }<br>
>    Error printFileName(StringRef Label, uint32_t Offset) {<br>
>      if (auto Result = getNameFromChecksumsBuffer(Offset)) {<br>
>        P.printString(Label, *Result);<br>
> @@ -149,6 +199,7 @@ private:<br>
>    }<br>
><br>
>    ScopedPrinter &P;<br>
> +  TypeDatabase &IPI;<br>
>  };<br>
>  }<br>
><br>
> @@ -618,6 +669,7 @@ Error LLVMOutputStyle::dumpTpiStream(uin<br>
><br>
>      if (auto EC = Visitor.visitTypeRecord(Type))<br>
>        return EC;<br>
> +    T.setIndex(T.getIndex() + 1);<br>
>    }<br>
>    if (HadError)<br>
>      return make_error<RawError>(raw_error_code::corrupt_file,<br>
> @@ -750,7 +802,7 @@ Error LLVMOutputStyle::dumpDbiStream() {<br>
>          if (opts::raw::DumpLineInfo) {<br>
>            ListScope SS(P, "LineInfo");<br>
><br>
> -          C13RawVisitor V(P, File);<br>
> +          C13RawVisitor V(P, File, ItemDB);<br>
>            if (auto EC = codeview::visitModuleDebugFragments(<br>
>                    ModS.linesAndChecksums(), V))<br>
>              return EC;<br>
><br>
> Modified: llvm/trunk/tools/llvm-pdbdump/PdbYaml.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PdbYaml.cpp?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PdbYaml.cpp?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-pdbdump/PdbYaml.cpp (original)<br>
> +++ llvm/trunk/tools/llvm-pdbdump/PdbYaml.cpp Tue May  2 11:56:09 2017<br>
> @@ -41,6 +41,8 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::<br>
>  LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::PdbSourceColumnEntry)<br>
>  LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::PdbSourceLineBlock)<br>
>  LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::PdbSourceLineInfo)<br>
> +LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::PdbInlineeSite)<br>
> +LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::PdbInlineeInfo)<br>
>  LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::PdbSymbolRecord)<br>
>  LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::PdbTpiRecord)<br>
>  LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::StreamBlockList)<br>
> @@ -336,6 +338,7 @@ void MappingContextTraits<pdb::yaml::Pdb<br>
>      mapping(IO &IO, PdbSourceLineInfo &Obj,<br>
>              pdb::yaml::SerializationContext &Context) {<br>
>    IO.mapRequired("CodeSize", Obj.CodeSize);<br>
> +<br>
>    IO.mapRequired("Flags", Obj.Flags);<br>
>    IO.mapRequired("RelocOffset", Obj.RelocOffset);<br>
>    IO.mapRequired("RelocSegment", Obj.RelocSegment);<br>
> @@ -348,6 +351,21 @@ void MappingContextTraits<pdb::yaml::Pdb<br>
>              pdb::yaml::SerializationContext &Context) {<br>
>    IO.mapOptionalWithContext("Checksums", Obj.FileChecksums, Context);<br>
>    IO.mapOptionalWithContext("Lines", Obj.LineFragments, Context);<br>
> +  IO.mapOptionalWithContext("InlineeLines", Obj.Inlinees, Context);<br>
> +}<br>
> +<br>
> +void MappingContextTraits<PdbInlineeSite, SerializationContext>::mapping(<br>
> +    IO &IO, PdbInlineeSite &Obj, SerializationContext &Context) {<br>
> +  IO.mapRequired("FileName", Obj.FileName);<br>
> +  IO.mapRequired("LineNum", Obj.SourceLineNum);<br>
> +  IO.mapRequired("Inlinee", Obj.Inlinee);<br>
> +  IO.mapOptional("ExtraFiles", Obj.ExtraFiles);<br>
> +}<br>
> +<br>
> +void MappingContextTraits<PdbInlineeInfo, SerializationContext>::mapping(<br>
> +    IO &IO, PdbInlineeInfo &Obj, SerializationContext &Context) {<br>
> +  IO.mapRequired("HasExtraFiles", Obj.HasExtraFiles);<br>
> +  IO.mapRequired("Sites", Obj.Sites, Context);<br>
>  }<br>
><br>
>  void MappingContextTraits<PdbTpiRecord, pdb::yaml::SerializationContext>::<br>
><br>
> Modified: llvm/trunk/tools/llvm-pdbdump/PdbYaml.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PdbYaml.h?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PdbYaml.h?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-pdbdump/PdbYaml.h (original)<br>
> +++ llvm/trunk/tools/llvm-pdbdump/PdbYaml.h Tue May  2 11:56:09 2017<br>
> @@ -102,9 +102,22 @@ struct PdbSourceLineInfo {<br>
>    std::vector<PdbSourceLineBlock> Blocks;<br>
>  };<br>
><br>
> +struct PdbInlineeSite {<br>
> +  codeview::TypeIndex Inlinee;<br>
> +  StringRef FileName;<br>
> +  uint32_t SourceLineNum;<br>
> +  std::vector<StringRef> ExtraFiles;<br>
> +};<br>
> +<br>
> +struct PdbInlineeInfo {<br>
> +  bool HasExtraFiles;<br>
> +  std::vector<PdbInlineeSite> Sites;<br>
> +};<br>
> +<br>
>  struct PdbSourceFileInfo {<br>
>    std::vector<PdbSourceFileChecksumEntry> FileChecksums;<br>
>    std::vector<PdbSourceLineInfo> LineFragments;<br>
> +  std::vector<PdbInlineeInfo> Inlinees;<br>
>  };<br>
><br>
>  struct PdbDbiModuleInfo {<br>
> @@ -258,6 +271,20 @@ struct MappingContextTraits<pdb::yaml::P<br>
>                        pdb::yaml::SerializationContext &Context);<br>
>  };<br>
><br>
> +template <><br>
> +struct MappingContextTraits<pdb::yaml::PdbInlineeInfo,<br>
> +                            pdb::yaml::SerializationContext> {<br>
> +  static void mapping(IO &IO, pdb::yaml::PdbInlineeInfo &Obj,<br>
> +                      pdb::yaml::SerializationContext &Context);<br>
> +};<br>
> +<br>
> +template <><br>
> +struct MappingContextTraits<pdb::yaml::PdbInlineeSite,<br>
> +                            pdb::yaml::SerializationContext> {<br>
> +  static void mapping(IO &IO, pdb::yaml::PdbInlineeSite &Obj,<br>
> +                      pdb::yaml::SerializationContext &Context);<br>
> +};<br>
> +<br>
>  template <><br>
>  struct MappingContextTraits<pdb::yaml::PdbTpiRecord,<br>
>                              pdb::yaml::SerializationContext> {<br>
><br>
> Modified: llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.cpp?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.cpp?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.cpp (original)<br>
> +++ llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.cpp Tue May  2 11:56:09 2017<br>
> @@ -17,6 +17,7 @@<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h"<br>
> +#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugUnknownFragment.h"<br>
>  #include "llvm/DebugInfo/MSF/MappedBlockStream.h"<br>
> @@ -146,6 +147,35 @@ public:<br>
>            }<br>
>          }<br>
>        }<br>
> +    }<br>
> +    return Error::success();<br>
> +  }<br>
> +<br>
> +  Error handleInlineeLines() override {<br>
> +    for (const auto &ILF : InlineeLines) {<br>
> +      Info.Inlinees.emplace_back();<br>
> +      auto &Inlinee = Info.Inlinees.back();<br>
> +<br>
> +      Inlinee.HasExtraFiles = ILF.hasExtraFiles();<br>
> +      for (const auto &IL : ILF) {<br>
> +        Inlinee.Sites.emplace_back();<br>
> +        auto &Site = Inlinee.Sites.back();<br>
> +        if (auto Result = getNameFromChecksumsBuffer(IL.Header->FileID))<br>
> +          Site.FileName = *Result;<br>
> +        else<br>
> +          return Result.takeError();<br>
> +<br>
> +        Site.Inlinee = IL.Header->Inlinee;<br>
> +        Site.SourceLineNum = IL.Header->SourceLineNum;<br>
> +        if (ILF.hasExtraFiles()) {<br>
> +          for (const auto &EF : IL.ExtraFiles) {<br>
> +            if (auto Result = getNameFromChecksumsBuffer(EF))<br>
> +              Site.ExtraFiles.push_back(*Result);<br>
> +            else<br>
> +              return Result.takeError();<br>
> +          }<br>
> +        }<br>
> +      }<br>
>      }<br>
>      return Error::success();<br>
>    }<br>
><br>
> Modified: llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp (original)<br>
> +++ llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp Tue May  2 11:56:09 2017<br>
> @@ -31,6 +31,9 @@<br>
>  #include "llvm/ADT/STLExtras.h"<br>
>  #include "llvm/ADT/StringExtras.h"<br>
>  #include "llvm/Config/config.h"<br>
> +#include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"<br>
> +#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"<br>
> +#include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h"<br>
>  #include "llvm/DebugInfo/MSF/MSFBuilder.h"<br>
>  #include "llvm/DebugInfo/PDB/GenericError.h"<br>
>  #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"<br>
> @@ -421,6 +424,21 @@ cl::list<std::string> InputFilename(cl::<br>
><br>
>  static ExitOnError ExitOnErr;<br>
><br>
> +static uint32_t<br>
> +getFileChecksumOffset(StringRef FileName,<br>
> +                      ModuleDebugFileChecksumFragment &Checksums,<br>
> +                      StringTableBuilder &Strings) {<br>
> +  // The offset in the line info record is the offset of the checksum<br>
> +  // entry for the corresponding file.  That entry then contains an<br>
> +  // offset into the global string table of the file name.  So to<br>
> +  // compute the proper offset to write into the line info record, we<br>
> +  // must first get its offset in the global string table, then ask the<br>
> +  // checksum builder to find the offset in its serialized buffer that<br>
> +  // it mapped that filename string table offset to.<br>
> +  uint32_t StringOffset = Strings.insert(FileName);<br>
> +  return Checksums.mapChecksumOffset(StringOffset);<br>
> +}<br>
> +<br>
>  static void yamlToPdb(StringRef Path) {<br>
>    BumpPtrAllocator Allocator;<br>
>    ErrorOr<std::unique_ptr<MemoryBuffer>> ErrorOrBuffer =<br>
> @@ -503,12 +521,19 @@ static void yamlToPdb(StringRef Path) {<br>
>        if (!FLI.FileChecksums.empty()) {<br>
>          auto &Strings = Builder.getStringTableBuilder();<br>
>          for (auto &FC : FLI.FileChecksums) {<br>
> -          uint32_t STOffset = Strings.getStringIndex(FC.FileName);<br>
> +          uint32_t STOffset = Strings.insert(FC.FileName);<br>
>            Checksums->addChecksum(STOffset, FC.Kind, FC.ChecksumBytes.Bytes);<br>
>          }<br>
>        }<br>
>        ModiBuilder.setC13FileChecksums(std::move(Checksums));<br>
><br>
> +      // FIXME: StringTable / StringTableBuilder should really be in<br>
> +      // DebugInfoCodeView.  This would allow us to construct the<br>
> +      // ModuleDebugLineFragment with a reference to the string table,<br>
> +      // and we could just pass strings around rather than having to<br>
> +      // remember how to calculate the right offset.<br>
> +      auto &Strings = Builder.getStringTableBuilder();<br>
> +<br>
>        for (const auto &Fragment : FLI.LineFragments) {<br>
>          auto Lines = llvm::make_unique<ModuleDebugLineFragment>();<br>
>          Lines->setCodeSize(Fragment.CodeSize);<br>
> @@ -516,21 +541,8 @@ static void yamlToPdb(StringRef Path) {<br>
>                                      Fragment.RelocOffset);<br>
>          Lines->setFlags(Fragment.Flags);<br>
>          for (const auto &LC : Fragment.Blocks) {<br>
> -          // FIXME: StringTable / StringTableBuilder should really be in<br>
> -          // DebugInfoCodeView.  This would allow us to construct the<br>
> -          // ModuleDebugLineFragment with a reference to the string table,<br>
> -          // and we could just pass strings around rather than having to<br>
> -          // remember how to calculate the right offset.<br>
> -          auto &Strings = Builder.getStringTableBuilder();<br>
> -          // The offset in the line info record is the offset of the checksum<br>
> -          // entry for the corresponding file.  That entry then contains an<br>
> -          // offset into the global string table of the file name.  So to<br>
> -          // compute the proper offset to write into the line info record, we<br>
> -          // must first get its offset in the global string table, then ask the<br>
> -          // checksum builder to find the offset in its serialized buffer that<br>
> -          // it mapped that filename string table offset to.<br>
> -          uint32_t StringOffset = Strings.getStringIndex(LC.FileName);<br>
> -          uint32_t ChecksumOffset = ChecksumRef.mapChecksumOffset(StringOffset);<br>
> +          uint32_t ChecksumOffset =<br>
> +              getFileChecksumOffset(LC.FileName, ChecksumRef, Strings);<br>
><br>
>            Lines->createBlock(ChecksumOffset);<br>
>            if (Lines->hasColumnInfo()) {<br>
> @@ -550,7 +562,26 @@ static void yamlToPdb(StringRef Path) {<br>
>              }<br>
>            }<br>
>          }<br>
> -        ModiBuilder.addC13LineFragment(std::move(Lines));<br>
> +        ModiBuilder.addC13Fragment(std::move(Lines));<br>
> +      }<br>
> +<br>
> +      for (const auto &Inlinee : FLI.Inlinees) {<br>
> +        auto Inlinees = llvm::make_unique<ModuleDebugInlineeLineFragment>(<br>
> +            Inlinee.HasExtraFiles);<br>
> +        for (const auto &Site : Inlinee.Sites) {<br>
> +          uint32_t FileOff =<br>
> +              getFileChecksumOffset(Site.FileName, ChecksumRef, Strings);<br>
> +<br>
> +          Inlinees->addInlineSite(Site.Inlinee, FileOff, Site.SourceLineNum);<br>
> +          if (!Inlinee.HasExtraFiles)<br>
> +            continue;<br>
> +<br>
> +          for (auto EF : Site.ExtraFiles) {<br>
> +            FileOff = getFileChecksumOffset(EF, ChecksumRef, Strings);<br>
> +            Inlinees->addExtraFile(FileOff);<br>
> +          }<br>
> +        }<br>
> +        ModiBuilder.addC13Fragment(std::move(Inlinees));<br>
>        }<br>
>      }<br>
>    }<br>
><br>
> Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=301936&r1=301935&r2=301936&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=301936&r1=301935&r2=301936&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)<br>
> +++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Tue May  2 11:56:09 2017<br>
> @@ -26,6 +26,7 @@<br>
>  #include "llvm/DebugInfo/CodeView/CodeView.h"<br>
>  #include "llvm/DebugInfo/CodeView/Line.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"<br>
> +#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h"<br>
>  #include "llvm/DebugInfo/CodeView/RecordSerialization.h"<br>
>  #include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"<br>
> @@ -986,27 +987,20 @@ void COFFDumper::printCodeViewFileChecks<br>
>  void COFFDumper::printCodeViewInlineeLines(StringRef Subsection) {<br>
>    BinaryByteStream S(Subsection, llvm::support::little);<br>
>    BinaryStreamReader SR(S);<br>
> -  uint32_t Signature;<br>
> -  error(SR.readInteger(Signature));<br>
> -  bool HasExtraFiles = Signature == unsigned(InlineeLinesSignature::ExtraFiles);<br>
> -<br>
> -  while (!SR.empty()) {<br>
> -    const InlineeSourceLine *ISL;<br>
> -    error(SR.readObject(ISL));<br>
> +  ModuleDebugInlineeLineFragmentRef Lines;<br>
> +  error(Lines.initialize(SR));<br>
> +<br>
> +  for (auto &Line : Lines) {<br>
>      DictScope S(W, "InlineeSourceLine");<br>
> -    printTypeIndex("Inlinee", ISL->Inlinee);<br>
> -    printFileNameForOffset("FileID", ISL->FileID);<br>
> -    W.printNumber("SourceLineNum", ISL->SourceLineNum);<br>
> -<br>
> -    if (HasExtraFiles) {<br>
> -      uint32_t ExtraFileCount;<br>
> -      error(SR.readInteger(ExtraFileCount));<br>
> -      W.printNumber("ExtraFileCount", ExtraFileCount);<br>
> +    printTypeIndex("Inlinee", Line.Header->Inlinee);<br>
> +    printFileNameForOffset("FileID", Line.Header->FileID);<br>
> +    W.printNumber("SourceLineNum", Line.Header->SourceLineNum);<br>
> +<br>
> +    if (Lines.hasExtraFiles()) {<br>
> +      W.printNumber("ExtraFileCount", Line.ExtraFiles.size());<br>
>        ListScope ExtraFiles(W, "ExtraFiles");<br>
> -      for (unsigned I = 0; I < ExtraFileCount; ++I) {<br>
> -        uint32_t FileID;<br>
> -        error(SR.readInteger(FileID));<br>
> -        printFileNameForOffset("FileID", FileID);<br>
> +      for (const auto &FID : Line.ExtraFiles) {<br>
> +        printFileNameForOffset("FileID", FID);<br>
>        }<br>
>      }<br>
>    }<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>