<div dir="ltr">Should be fixed in r304846.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 6, 2017 at 4:43 PM Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Sorry, I just now saw this.  I will fix it now</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 6, 2017 at 4:34 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">Still failing!<br>
<br>
On Tue, Jun 6, 2017 at 2:20 PM, Evgenii Stepanov<br>
<<a href="mailto:eugeni.stepanov@gmail.com" target="_blank">eugeni.stepanov@gmail.com</a>> wrote:<br>
> ==8430==WARNING: MemorySanitizer: use-of-uninitialized-value<br>
>     #0 0x6df73b in<br>
> llvm::pdb::DbiStream::visitSectionContributions(llvm::pdb::ISectionContribVisitor&)<br>
> const /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp:219:7<br>
>     #1 0x53ba0c in llvm::pdb::LLVMOutputStyle::dumpSectionContribs()<br>
> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp:919:8<br>
>     #2 0x52a525 in llvm::pdb::LLVMOutputStyle::dump()<br>
> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp:286:17<br>
>     #3 0x505f8d in dumpRaw<br>
> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp:592:16<br>
>     #4 0x505f8d 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_msan/include/c++/v1/algorithm:965<br>
>     #5 0x505f8d in main<br>
> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp:963<br>
>     #6 0x7f42790ed82f in __libc_start_main<br>
> (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)<br>
>     #7 0x450688 in _start<br>
> (/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/llvm-pdbdump+0x450688)<br>
><br>
> <a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/5488/steps/check-llvm%20msan/logs/stdio" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/5488/steps/check-llvm%20msan/logs/stdio</a><br>
><br>
> On Mon, Jun 5, 2017 at 2:40 PM, 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: Mon Jun  5 16:40:33 2017<br>
>> New Revision: 304738<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=304738&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=304738&view=rev</a><br>
>> Log:<br>
>> [CodeView] Handle Cross Module Imports and Exports.<br>
>><br>
>> While it's not entirely clear why a compiler or linker might<br>
>> put this information into an object or PDB file, one has been<br>
>> spotted in the wild which was causing llvm-pdbdump to crash.<br>
>><br>
>> This patch adds support for reading-writing these sections.<br>
>> Since I don't know how to get one of the native tools to<br>
>> generate this kind of debug info, the only test here is one<br>
>> in which we feed YAML into the tool to produce a PDB and<br>
>> then spit out YAML from the resulting PDB and make sure that<br>
>> it matches.<br>
>><br>
>> Added:<br>
>>     llvm/trunk/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h<br>
>>     llvm/trunk/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h<br>
>>     llvm/trunk/lib/DebugInfo/CodeView/DebugCrossExSubsection.cpp<br>
>>     llvm/trunk/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp<br>
>>     llvm/trunk/test/DebugInfo/PDB/Inputs/cross-module-import-export.yaml<br>
>>     llvm/trunk/test/DebugInfo/PDB/cross-module-import-export.test<br>
>> Modified:<br>
>>     llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h<br>
>>     llvm/trunk/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h<br>
>>     llvm/trunk/include/llvm/ObjectYAML/CodeViewYAMLDebugSections.h<br>
>>     llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt<br>
>>     llvm/trunk/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp<br>
>>     llvm/trunk/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp<br>
>>     llvm/trunk/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp<br>
>>     llvm/trunk/lib/DebugInfo/PDB/Native/PublicsStream.cpp<br>
>>     llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp<br>
>>     llvm/trunk/lib/ObjectYAML/CodeViewYAMLSymbols.cpp<br>
>>     llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.cpp<br>
>>     llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.h<br>
>>     llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.cpp<br>
>>     llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.cpp<br>
>><br>
>> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h?rev=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h (original)<br>
>> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h Mon Jun  5 16:40:33 2017<br>
>> @@ -575,6 +575,24 @@ struct FrameData {<br>
>>    };<br>
>>  };<br>
>><br>
>> +// Corresponds to LocalIdAndGlobalIdPair structure.<br>
>> +// This structure information allows cross-referencing between PDBs.  For<br>
>> +// example, when a PDB is being built during compilation it is not yet known<br>
>> +// what other modules may end up in the PDB at link time.  So certain types of<br>
>> +// IDs may clash between the various compile time PDBs.  For each affected<br>
>> +// module, a subsection would be put into the PDB containing a mapping from its<br>
>> +// local IDs to a single ID namespace for all items in the PDB file.<br>
>> +struct CrossModuleExport {<br>
>> +  support::ulittle32_t Local;<br>
>> +  support::ulittle32_t Global;<br>
>> +};<br>
>> +<br>
>> +struct CrossModuleImport {<br>
>> +  support::ulittle32_t ModuleNameOffset;<br>
>> +  support::ulittle32_t Count; // Number of elements<br>
>> +  // support::ulittle32_t ids[Count]; // id from referenced module<br>
>> +};<br>
>> +<br>
>>  enum class CodeViewContainer { ObjectFile, Pdb };<br>
>><br>
>>  inline uint32_t alignOf(CodeViewContainer Container) {<br>
>><br>
>> Added: llvm/trunk/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h?rev=304738&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h?rev=304738&view=auto</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h (added)<br>
>> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h Mon Jun  5 16:40:33 2017<br>
>> @@ -0,0 +1,64 @@<br>
>> +//===- DebugCrossExSubsection.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_DEBUGCROSSEXSUBSECTION_H<br>
>> +#define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H<br>
>> +<br>
>> +#include "llvm/DebugInfo/CodeView/DebugSubsection.h"<br>
>> +#include "llvm/Support/BinaryStreamArray.h"<br>
>> +#include "llvm/Support/BinaryStreamReader.h"<br>
>> +#include "llvm/Support/Endian.h"<br>
>> +<br>
>> +#include <map><br>
>> +<br>
>> +namespace llvm {<br>
>> +namespace codeview {<br>
>> +class DebugCrossModuleExportsSubsectionRef final : public DebugSubsectionRef {<br>
>> +  typedef FixedStreamArray<CrossModuleExport> ReferenceArray;<br>
>> +  typedef ReferenceArray::Iterator Iterator;<br>
>> +<br>
>> +public:<br>
>> +  DebugCrossModuleExportsSubsectionRef()<br>
>> +      : DebugSubsectionRef(DebugSubsectionKind::CrossScopeExports) {}<br>
>> +<br>
>> +  static bool classof(const DebugSubsectionRef *S) {<br>
>> +    return S->kind() == DebugSubsectionKind::CrossScopeExports;<br>
>> +  }<br>
>> +<br>
>> +  Error initialize(BinaryStreamReader Reader);<br>
>> +  Error initialize(BinaryStreamRef Stream);<br>
>> +<br>
>> +  Iterator begin() const { return References.begin(); }<br>
>> +  Iterator end() const { return References.end(); }<br>
>> +<br>
>> +private:<br>
>> +  FixedStreamArray<CrossModuleExport> References;<br>
>> +};<br>
>> +<br>
>> +class DebugCrossModuleExportsSubsection final : public DebugSubsection {<br>
>> +public:<br>
>> +  DebugCrossModuleExportsSubsection()<br>
>> +      : DebugSubsection(DebugSubsectionKind::CrossScopeExports) {}<br>
>> +<br>
>> +  static bool classof(const DebugSubsection *S) {<br>
>> +    return S->kind() == DebugSubsectionKind::CrossScopeExports;<br>
>> +  }<br>
>> +<br>
>> +  void addMapping(uint32_t Local, uint32_t Global);<br>
>> +<br>
>> +  uint32_t calculateSerializedSize() const override;<br>
>> +  Error commit(BinaryStreamWriter &Writer) const override;<br>
>> +<br>
>> +private:<br>
>> +  std::map<uint32_t, uint32_t> Mappings;<br>
>> +};<br>
>> +}<br>
>> +}<br>
>> +<br>
>> +#endif<br>
>><br>
>> Added: llvm/trunk/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h?rev=304738&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h?rev=304738&view=auto</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h (added)<br>
>> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h Mon Jun  5 16:40:33 2017<br>
>> @@ -0,0 +1,88 @@<br>
>> +//===- DebugCrossExSubsection.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_DEBUGCROSSIMPSUBSECTION_H<br>
>> +#define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSIMPSUBSECTION_H<br>
>> +<br>
>> +#include "llvm/ADT/StringMap.h"<br>
>> +#include "llvm/DebugInfo/CodeView/DebugSubsection.h"<br>
>> +#include "llvm/Support/BinaryStreamArray.h"<br>
>> +#include "llvm/Support/BinaryStreamReader.h"<br>
>> +#include "llvm/Support/Endian.h"<br>
>> +<br>
>> +namespace llvm {<br>
>> +namespace codeview {<br>
>> +<br>
>> +struct CrossModuleImportItem {<br>
>> +  const CrossModuleImport *Header = nullptr;<br>
>> +  llvm::FixedStreamArray<support::ulittle32_t> Imports;<br>
>> +};<br>
>> +}<br>
>> +}<br>
>> +<br>
>> +namespace llvm {<br>
>> +template <> struct VarStreamArrayExtractor<codeview::CrossModuleImportItem> {<br>
>> +public:<br>
>> +  typedef void ContextType;<br>
>> +<br>
>> +  static Error extract(BinaryStreamRef Stream, uint32_t &Len,<br>
>> +                       codeview::CrossModuleImportItem &Item);<br>
>> +};<br>
>> +}<br>
>> +<br>
>> +namespace llvm {<br>
>> +namespace codeview {<br>
>> +class DebugStringTableSubsection;<br>
>> +<br>
>> +class DebugCrossModuleImportsSubsectionRef final : public DebugSubsectionRef {<br>
>> +  typedef VarStreamArray<CrossModuleImportItem> ReferenceArray;<br>
>> +  typedef ReferenceArray::Iterator Iterator;<br>
>> +<br>
>> +public:<br>
>> +  DebugCrossModuleImportsSubsectionRef()<br>
>> +      : DebugSubsectionRef(DebugSubsectionKind::CrossScopeImports) {}<br>
>> +<br>
>> +  static bool classof(const DebugSubsectionRef *S) {<br>
>> +    return S->kind() == DebugSubsectionKind::CrossScopeImports;<br>
>> +  }<br>
>> +<br>
>> +  Error initialize(BinaryStreamReader Reader);<br>
>> +  Error initialize(BinaryStreamRef Stream);<br>
>> +<br>
>> +  Iterator begin() const { return References.begin(); }<br>
>> +  Iterator end() const { return References.end(); }<br>
>> +<br>
>> +private:<br>
>> +  ReferenceArray References;<br>
>> +};<br>
>> +<br>
>> +class DebugCrossModuleImportsSubsection final : public DebugSubsection {<br>
>> +public:<br>
>> +  explicit DebugCrossModuleImportsSubsection(<br>
>> +      DebugStringTableSubsection &Strings)<br>
>> +      : DebugSubsection(DebugSubsectionKind::CrossScopeImports),<br>
>> +        Strings(Strings) {}<br>
>> +<br>
>> +  static bool classof(const DebugSubsection *S) {<br>
>> +    return S->kind() == DebugSubsectionKind::CrossScopeImports;<br>
>> +  }<br>
>> +<br>
>> +  void addImport(StringRef Module, uint32_t ImportId);<br>
>> +<br>
>> +  uint32_t calculateSerializedSize() const override;<br>
>> +  Error commit(BinaryStreamWriter &Writer) const override;<br>
>> +<br>
>> +private:<br>
>> +  DebugStringTableSubsection &Strings;<br>
>> +  StringMap<std::vector<support::ulittle32_t>> Mappings;<br>
>> +};<br>
>> +}<br>
>> +}<br>
>> +<br>
>> +#endif<br>
>><br>
>> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h?rev=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h (original)<br>
>> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h Mon Jun  5 16:40:33 2017<br>
>> @@ -20,6 +20,8 @@ namespace codeview {<br>
>>  class DebugChecksumsSubsectionRef;<br>
>>  class DebugSubsectionRecord;<br>
>>  class DebugInlineeLinesSubsectionRef;<br>
>> +class DebugCrossModuleExportsSubsectionRef;<br>
>> +class DebugCrossModuleImportsSubsectionRef;<br>
>>  class DebugLinesSubsectionRef;<br>
>>  class DebugUnknownSubsectionRef;<br>
>><br>
>> @@ -42,6 +44,16 @@ public:<br>
>>      return Error::success();<br>
>>    }<br>
>><br>
>> +  virtual Error<br>
>> +  visitCrossModuleExports(DebugCrossModuleExportsSubsectionRef &CSE) {<br>
>> +    return Error::success();<br>
>> +  }<br>
>> +<br>
>> +  virtual Error<br>
>> +  visitCrossModuleImports(DebugCrossModuleImportsSubsectionRef &CSE) {<br>
>> +    return Error::success();<br>
>> +  }<br>
>> +<br>
>>    virtual Error finished() { return Error::success(); }<br>
>>  };<br>
>><br>
>><br>
>> Modified: llvm/trunk/include/llvm/ObjectYAML/CodeViewYAMLDebugSections.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ObjectYAML/CodeViewYAMLDebugSections.h?rev=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ObjectYAML/CodeViewYAMLDebugSections.h?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/include/llvm/ObjectYAML/CodeViewYAMLDebugSections.h (original)<br>
>> +++ llvm/trunk/include/llvm/ObjectYAML/CodeViewYAMLDebugSections.h Mon Jun  5 16:40:33 2017<br>
>> @@ -33,6 +33,11 @@ namespace detail {<br>
>>  struct YAMLSubsectionBase;<br>
>>  }<br>
>><br>
>> +struct YAMLCrossModuleImport {<br>
>> +  StringRef ModuleName;<br>
>> +  std::vector<uint32_t> ImportIds;<br>
>> +};<br>
>> +<br>
>>  struct SourceLineEntry {<br>
>>    uint32_t Offset;<br>
>>    uint32_t LineStart;<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=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt (original)<br>
>> +++ llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt Mon Jun  5 16:40:33 2017<br>
>> @@ -3,11 +3,9 @@ add_llvm_library(LLVMDebugInfoCodeView<br>
>>    CodeViewRecordIO.cpp<br>
>>    CVSymbolVisitor.cpp<br>
>>    CVTypeVisitor.cpp<br>
>> -  EnumTables.cpp<br>
>> -  Formatters.cpp<br>
>> -  LazyRandomTypeCollection.cpp<br>
>> -  Line.cpp<br>
>>    DebugChecksumsSubsection.cpp<br>
>> +  DebugCrossExSubsection.cpp<br>
>> +  DebugCrossImpSubsection.cpp<br>
>>    DebugFrameDataSubsection.cpp<br>
>>    DebugInlineeLinesSubsection.cpp<br>
>>    DebugLinesSubsection.cpp<br>
>> @@ -16,6 +14,10 @@ add_llvm_library(LLVMDebugInfoCodeView<br>
>>    DebugSubsectionRecord.cpp<br>
>>    DebugSubsectionVisitor.cpp<br>
>>    DebugSymbolsSubsection.cpp<br>
>> +  EnumTables.cpp<br>
>> +  Formatters.cpp<br>
>> +  LazyRandomTypeCollection.cpp<br>
>> +  Line.cpp<br>
>>    RecordSerialization.cpp<br>
>>    SymbolRecordMapping.cpp<br>
>>    SymbolDumper.cpp<br>
>><br>
>> Added: llvm/trunk/lib/DebugInfo/CodeView/DebugCrossExSubsection.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/DebugCrossExSubsection.cpp?rev=304738&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/DebugCrossExSubsection.cpp?rev=304738&view=auto</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/DebugInfo/CodeView/DebugCrossExSubsection.cpp (added)<br>
>> +++ llvm/trunk/lib/DebugInfo/CodeView/DebugCrossExSubsection.cpp Mon Jun  5 16:40:33 2017<br>
>> @@ -0,0 +1,49 @@<br>
>> +//===- DebugCrossExSubsection.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/DebugCrossExSubsection.h"<br>
>> +<br>
>> +#include "llvm/DebugInfo/CodeView/CodeViewError.h"<br>
>> +<br>
>> +using namespace llvm;<br>
>> +using namespace llvm::codeview;<br>
>> +<br>
>> +Error DebugCrossModuleExportsSubsectionRef::initialize(<br>
>> +    BinaryStreamReader Reader) {<br>
>> +  if (Reader.bytesRemaining() % sizeof(CrossModuleExport) != 0)<br>
>> +    return make_error<CodeViewError>(<br>
>> +        cv_error_code::corrupt_record,<br>
>> +        "Cross Scope Exports section is an invalid size!");<br>
>> +<br>
>> +  uint32_t Size = Reader.bytesRemaining() / sizeof(CrossModuleExport);<br>
>> +  return Reader.readArray(References, Size);<br>
>> +}<br>
>> +<br>
>> +Error DebugCrossModuleExportsSubsectionRef::initialize(BinaryStreamRef Stream) {<br>
>> +  BinaryStreamReader Reader(Stream);<br>
>> +  return initialize(Reader);<br>
>> +}<br>
>> +<br>
>> +void DebugCrossModuleExportsSubsection::addMapping(uint32_t Local,<br>
>> +                                                   uint32_t Global) {<br>
>> +  Mappings[Local] = Global;<br>
>> +}<br>
>> +<br>
>> +uint32_t DebugCrossModuleExportsSubsection::calculateSerializedSize() const {<br>
>> +  return Mappings.size() * sizeof(CrossModuleExport);<br>
>> +}<br>
>> +<br>
>> +Error DebugCrossModuleExportsSubsection::commit(<br>
>> +    BinaryStreamWriter &Writer) const {<br>
>> +  for (const auto &M : Mappings) {<br>
>> +    if (auto EC = Writer.writeObject(M))<br>
>> +      return EC;<br>
>> +  }<br>
>> +  return Error::success();<br>
>> +}<br>
>><br>
>> Added: llvm/trunk/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp?rev=304738&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp?rev=304738&view=auto</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp (added)<br>
>> +++ llvm/trunk/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp Mon Jun  5 16:40:33 2017<br>
>> @@ -0,0 +1,91 @@<br>
>> +//===- DebugCrossImpSubsection.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/DebugCrossImpSubsection.h"<br>
>> +<br>
>> +#include "llvm/DebugInfo/CodeView/CodeViewError.h"<br>
>> +#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"<br>
>> +<br>
>> +using namespace llvm;<br>
>> +using namespace llvm::codeview;<br>
>> +<br>
>> +namespace llvm {<br>
>> +Error VarStreamArrayExtractor<CrossModuleImportItem>::extract(<br>
>> +    BinaryStreamRef Stream, uint32_t &Len,<br>
>> +    codeview::CrossModuleImportItem &Item) {<br>
>> +  BinaryStreamReader Reader(Stream);<br>
>> +  if (Reader.bytesRemaining() < sizeof(CrossModuleImport))<br>
>> +    return make_error<CodeViewError>(<br>
>> +        cv_error_code::insufficient_buffer,<br>
>> +        "Not enough bytes for a Cross Module Import Header!");<br>
>> +  if (auto EC = Reader.readObject(Item.Header))<br>
>> +    return EC;<br>
>> +  if (Reader.bytesRemaining() < Item.Header->Count * sizeof(uint32_t))<br>
>> +    return make_error<CodeViewError>(<br>
>> +        cv_error_code::insufficient_buffer,<br>
>> +        "Not enough to read specified number of Cross Module References!");<br>
>> +  if (auto EC = Reader.readArray(Item.Imports, Item.Header->Count))<br>
>> +    return EC;<br>
>> +  return Error::success();<br>
>> +}<br>
>> +}<br>
>> +<br>
>> +Error DebugCrossModuleImportsSubsectionRef::initialize(<br>
>> +    BinaryStreamReader Reader) {<br>
>> +  return Reader.readArray(References, Reader.bytesRemaining());<br>
>> +}<br>
>> +<br>
>> +Error DebugCrossModuleImportsSubsectionRef::initialize(BinaryStreamRef Stream) {<br>
>> +  BinaryStreamReader Reader(Stream);<br>
>> +  return initialize(Reader);<br>
>> +}<br>
>> +<br>
>> +void DebugCrossModuleImportsSubsection::addImport(StringRef Module,<br>
>> +                                                  uint32_t ImportId) {<br>
>> +  Strings.insert(Module);<br>
>> +  std::vector<support::ulittle32_t> Targets = {support::ulittle32_t(ImportId)};<br>
>> +  auto Result = Mappings.insert(std::make_pair(Module, Targets));<br>
>> +  if (!Result.second)<br>
>> +    Result.first->getValue().push_back(Targets[0]);<br>
>> +}<br>
>> +<br>
>> +uint32_t DebugCrossModuleImportsSubsection::calculateSerializedSize() const {<br>
>> +  uint32_t Size = 0;<br>
>> +  for (const auto &Item : Mappings) {<br>
>> +    Size += sizeof(CrossModuleImport);<br>
>> +    Size += sizeof(support::ulittle32_t) * Item.second.size();<br>
>> +  }<br>
>> +  return Size;<br>
>> +}<br>
>> +<br>
>> +Error DebugCrossModuleImportsSubsection::commit(<br>
>> +    BinaryStreamWriter &Writer) const {<br>
>> +  using T = decltype(&*Mappings.begin());<br>
>> +  std::vector<T> Ids;<br>
>> +  Ids.reserve(Mappings.size());<br>
>> +<br>
>> +  for (const auto &M : Mappings)<br>
>> +    Ids.push_back(&M);<br>
>> +<br>
>> +  std::sort(Ids.begin(), Ids.end(), [this](const T &L1, const T &L2) {<br>
>> +    return Strings.getStringId(L1->getKey()) <<br>
>> +           Strings.getStringId(L2->getKey());<br>
>> +  });<br>
>> +<br>
>> +  for (const auto &Item : Ids) {<br>
>> +    CrossModuleImport Imp;<br>
>> +    Imp.ModuleNameOffset = Strings.getStringId(Item->getKey());<br>
>> +    Imp.Count = Item->getValue().size();<br>
>> +    if (auto EC = Writer.writeObject(Imp))<br>
>> +      return EC;<br>
>> +    if (auto EC = Writer.writeArray(makeArrayRef(Item->getValue())))<br>
>> +      return EC;<br>
>> +  }<br>
>> +  return Error::success();<br>
>> +}<br>
>><br>
>> Modified: llvm/trunk/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp?rev=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp (original)<br>
>> +++ llvm/trunk/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp Mon Jun  5 16:40:33 2017<br>
>> @@ -38,6 +38,8 @@ Error DebugSubsectionRecord::initialize(<br>
>>    case DebugSubsectionKind::FileChecksums:<br>
>>    case DebugSubsectionKind::Lines:<br>
>>    case DebugSubsectionKind::InlineeLines:<br>
>> +  case DebugSubsectionKind::CrossScopeExports:<br>
>> +  case DebugSubsectionKind::CrossScopeImports:<br>
>>      break;<br>
>>    default:<br>
>>      llvm_unreachable("Unexpected debug fragment kind!");<br>
>><br>
>> Modified: llvm/trunk/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp?rev=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp (original)<br>
>> +++ llvm/trunk/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp Mon Jun  5 16:40:33 2017<br>
>> @@ -10,6 +10,8 @@<br>
>>  #include "llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h"<br>
>><br>
>>  #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"<br>
>> +#include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h"<br>
>> +#include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"<br>
>> @@ -44,6 +46,18 @@ Error llvm::codeview::visitDebugSubsecti<br>
>>        return EC;<br>
>>      return V.visitInlineeLines(Fragment);<br>
>>    }<br>
>> +  case DebugSubsectionKind::CrossScopeExports: {<br>
>> +    DebugCrossModuleExportsSubsectionRef Section;<br>
>> +    if (auto EC = Section.initialize(Reader))<br>
>> +      return EC;<br>
>> +    return V.visitCrossModuleExports(Section);<br>
>> +  }<br>
>> +  case DebugSubsectionKind::CrossScopeImports: {<br>
>> +    DebugCrossModuleImportsSubsectionRef Section;<br>
>> +    if (auto EC = Section.initialize(Reader))<br>
>> +      return EC;<br>
>> +    return V.visitCrossModuleImports(Section);<br>
>> +  }<br>
>>    default: {<br>
>>      DebugUnknownSubsectionRef Fragment(R.kind(), R.getRecordData());<br>
>>      return V.visitUnknown(Fragment);<br>
>><br>
>> Modified: llvm/trunk/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp?rev=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp (original)<br>
>> +++ llvm/trunk/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp Mon Jun  5 16:40:33 2017<br>
>> @@ -90,14 +90,14 @@ Error ModuleDebugStreamRef::commit() { r<br>
>><br>
>>  Expected<codeview::DebugChecksumsSubsectionRef><br>
>>  ModuleDebugStreamRef::findChecksumsSubsection() const {<br>
>> +  codeview::DebugChecksumsSubsectionRef Result;<br>
>>    for (const auto &SS : subsections()) {<br>
>>      if (SS.kind() != DebugSubsectionKind::FileChecksums)<br>
>>        continue;<br>
>><br>
>> -    codeview::DebugChecksumsSubsectionRef Result;<br>
>>      if (auto EC = Result.initialize(SS.getRecordData()))<br>
>>        return std::move(EC);<br>
>>      return Result;<br>
>>    }<br>
>> -  return make_error<RawError>(raw_error_code::no_entry);<br>
>> +  return Result;<br>
>>  }<br>
>><br>
>> Modified: llvm/trunk/lib/DebugInfo/PDB/Native/PublicsStream.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/PublicsStream.cpp?rev=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/PublicsStream.cpp?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/DebugInfo/PDB/Native/PublicsStream.cpp (original)<br>
>> +++ llvm/trunk/lib/DebugInfo/PDB/Native/PublicsStream.cpp Mon Jun  5 16:40:33 2017<br>
>> @@ -105,10 +105,12 @@ Error PublicsStream::reload() {<br>
>>                                             "Could not read a thunk map."));<br>
>><br>
>>    // Something called "section map" follows.<br>
>> -  if (auto EC = Reader.readArray(SectionOffsets, Header->NumSections))<br>
>> -    return joinErrors(std::move(EC),<br>
>> -                      make_error<RawError>(raw_error_code::corrupt_file,<br>
>> -                                           "Could not read a section map."));<br>
>> +  if (Reader.bytesRemaining() > 0) {<br>
>> +    if (auto EC = Reader.readArray(SectionOffsets, Header->NumSections))<br>
>> +      return joinErrors(std::move(EC),<br>
>> +                        make_error<RawError>(raw_error_code::corrupt_file,<br>
>> +                                             "Could not read a section map."));<br>
>> +  }<br>
>><br>
>>    if (Reader.bytesRemaining() > 0)<br>
>>      return make_error<RawError>(raw_error_code::corrupt_file,<br>
>><br>
>> Modified: llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp?rev=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp (original)<br>
>> +++ llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp Mon Jun  5 16:40:33 2017<br>
>> @@ -18,6 +18,8 @@<br>
>>  #include "llvm/ADT/StringSwitch.h"<br>
>>  #include "llvm/DebugInfo/CodeView/CodeViewError.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"<br>
>> +#include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h"<br>
>> +#include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"<br>
>> @@ -38,13 +40,19 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(SourceLineB<br>
>>  LLVM_YAML_IS_SEQUENCE_VECTOR(SourceLineInfo)<br>
>>  LLVM_YAML_IS_SEQUENCE_VECTOR(InlineeSite)<br>
>>  LLVM_YAML_IS_SEQUENCE_VECTOR(InlineeInfo)<br>
>> +LLVM_YAML_IS_SEQUENCE_VECTOR(CrossModuleExport)<br>
>> +LLVM_YAML_IS_SEQUENCE_VECTOR(YAMLCrossModuleImport)<br>
>>  LLVM_YAML_IS_SEQUENCE_VECTOR(StringRef)<br>
>> +LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint32_t)<br>
>><br>
>>  LLVM_YAML_DECLARE_SCALAR_TRAITS(HexFormattedString, false)<br>
>>  LLVM_YAML_DECLARE_ENUM_TRAITS(DebugSubsectionKind)<br>
>>  LLVM_YAML_DECLARE_ENUM_TRAITS(FileChecksumKind)<br>
>>  LLVM_YAML_DECLARE_BITSET_TRAITS(LineFlags)<br>
>><br>
>> +LLVM_YAML_DECLARE_MAPPING_TRAITS(CrossModuleExport)<br>
>> +LLVM_YAML_DECLARE_MAPPING_TRAITS(YAMLCrossModuleImport)<br>
>> +LLVM_YAML_DECLARE_MAPPING_TRAITS(CrossModuleImportItem)<br>
>>  LLVM_YAML_DECLARE_MAPPING_TRAITS(SourceLineEntry)<br>
>>  LLVM_YAML_DECLARE_MAPPING_TRAITS(SourceColumnEntry)<br>
>>  LLVM_YAML_DECLARE_MAPPING_TRAITS(SourceFileChecksumEntry)<br>
>> @@ -114,6 +122,35 @@ struct YAMLInlineeLinesSubsection : publ<br>
>><br>
>>    InlineeInfo InlineeLines;<br>
>>  };<br>
>> +<br>
>> +struct YAMLCrossModuleExportsSubsection : public YAMLSubsectionBase {<br>
>> +  YAMLCrossModuleExportsSubsection()<br>
>> +      : YAMLSubsectionBase(DebugSubsectionKind::CrossScopeExports) {}<br>
>> +<br>
>> +  void map(IO &IO) override;<br>
>> +  std::unique_ptr<DebugSubsection><br>
>> +  toCodeViewSubsection(DebugStringTableSubsection *Strings,<br>
>> +                       DebugChecksumsSubsection *Checksums) const override;<br>
>> +  static Expected<std::shared_ptr<YAMLCrossModuleExportsSubsection>><br>
>> +  fromCodeViewSubsection(const DebugCrossModuleExportsSubsectionRef &Exports);<br>
>> +<br>
>> +  std::vector<CrossModuleExport> Exports;<br>
>> +};<br>
>> +<br>
>> +struct YAMLCrossModuleImportsSubsection : public YAMLSubsectionBase {<br>
>> +  YAMLCrossModuleImportsSubsection()<br>
>> +      : YAMLSubsectionBase(DebugSubsectionKind::CrossScopeImports) {}<br>
>> +<br>
>> +  void map(IO &IO) override;<br>
>> +  std::unique_ptr<DebugSubsection><br>
>> +  toCodeViewSubsection(DebugStringTableSubsection *Strings,<br>
>> +                       DebugChecksumsSubsection *Checksums) const override;<br>
>> +  static Expected<std::shared_ptr<YAMLCrossModuleImportsSubsection>><br>
>> +  fromCodeViewSubsection(const DebugStringTableSubsectionRef &Strings,<br>
>> +                         const DebugCrossModuleImportsSubsectionRef &Imports);<br>
>> +<br>
>> +  std::vector<YAMLCrossModuleImport> Imports;<br>
>> +};<br>
>>  }<br>
>><br>
>>  void ScalarBitSetTraits<LineFlags>::bitset(IO &io, LineFlags &Flags) {<br>
>> @@ -161,6 +198,17 @@ void MappingTraits<SourceLineBlock>::map<br>
>>    IO.mapRequired("Columns", Obj.Columns);<br>
>>  }<br>
>><br>
>> +void MappingTraits<CrossModuleExport>::mapping(IO &IO, CrossModuleExport &Obj) {<br>
>> +  IO.mapRequired("LocalId", Obj.Local);<br>
>> +  IO.mapRequired("GlobalId", Obj.Global);<br>
>> +}<br>
>> +<br>
>> +void MappingTraits<YAMLCrossModuleImport>::mapping(IO &IO,<br>
>> +                                                   YAMLCrossModuleImport &Obj) {<br>
>> +  IO.mapRequired("Module", Obj.ModuleName);<br>
>> +  IO.mapRequired("Imports", Obj.ImportIds);<br>
>> +}<br>
>> +<br>
>>  void MappingTraits<SourceFileChecksumEntry>::mapping(<br>
>>      IO &IO, SourceFileChecksumEntry &Obj) {<br>
>>    IO.mapRequired("FileName", Obj.FileName);<br>
>> @@ -196,6 +244,16 @@ void YAMLInlineeLinesSubsection::map(IO<br>
>>    IO.mapRequired("Sites", InlineeLines.Sites);<br>
>>  }<br>
>><br>
>> +void YAMLCrossModuleExportsSubsection::map(IO &IO) {<br>
>> +  IO.mapTag("!CrossModuleExports", true);<br>
>> +  IO.mapOptional("Exports", Exports);<br>
>> +}<br>
>> +<br>
>> +void YAMLCrossModuleImportsSubsection::map(IO &IO) {<br>
>> +  IO.mapTag("!CrossModuleImports", true);<br>
>> +  IO.mapOptional("Imports", Imports);<br>
>> +}<br>
>> +<br>
>>  void MappingTraits<YAMLDebugSubsection>::mapping(<br>
>>      IO &IO, YAMLDebugSubsection &Subsection) {<br>
>>    if (!IO.outputting()) {<br>
>> @@ -206,6 +264,12 @@ void MappingTraits<YAMLDebugSubsection>:<br>
>>        Subsection.Subsection = std::make_shared<YAMLLinesSubsection>();<br>
>>      } else if (IO.mapTag("!InlineeLines")) {<br>
>>        Subsection.Subsection = std::make_shared<YAMLInlineeLinesSubsection>();<br>
>> +    } else if (IO.mapTag("!CrossModuleExports")) {<br>
>> +      Subsection.Subsection =<br>
>> +          std::make_shared<YAMLCrossModuleExportsSubsection>();<br>
>> +    } else if (IO.mapTag("!CrossModuleImports")) {<br>
>> +      Subsection.Subsection =<br>
>> +          std::make_shared<YAMLCrossModuleImportsSubsection>();<br>
>>      } else {<br>
>>        llvm_unreachable("Unexpected subsection tag!");<br>
>>      }<br>
>> @@ -213,14 +277,15 @@ void MappingTraits<YAMLDebugSubsection>:<br>
>>    Subsection.Subsection->map(IO);<br>
>>  }<br>
>><br>
>> -static Expected<const YAMLChecksumsSubsection &><br>
>> +static std::shared_ptr<YAMLChecksumsSubsection><br>
>>  findChecksums(ArrayRef<YAMLDebugSubsection> Subsections) {<br>
>>    for (const auto &SS : Subsections) {<br>
>>      if (SS.Subsection->Kind == DebugSubsectionKind::FileChecksums) {<br>
>> -      return static_cast<const YAMLChecksumsSubsection &>(*SS.Subsection);<br>
>> +      return std::static_pointer_cast<YAMLChecksumsSubsection>(SS.Subsection);<br>
>>      }<br>
>>    }<br>
>> -  return make_error<CodeViewError>(cv_error_code::no_records);<br>
>> +<br>
>> +  return nullptr;<br>
>>  }<br>
>><br>
>>  std::unique_ptr<DebugSubsection> YAMLChecksumsSubsection::toCodeViewSubsection(<br>
>> @@ -285,6 +350,28 @@ YAMLInlineeLinesSubsection::toCodeViewSu<br>
>>    return llvm::cast<DebugSubsection>(std::move(Result));<br>
>>  }<br>
>><br>
>> +std::unique_ptr<DebugSubsection><br>
>> +YAMLCrossModuleExportsSubsection::toCodeViewSubsection(<br>
>> +    DebugStringTableSubsection *Strings,<br>
>> +    DebugChecksumsSubsection *Checksums) const {<br>
>> +  auto Result = llvm::make_unique<DebugCrossModuleExportsSubsection>();<br>
>> +  for (const auto &M : Exports)<br>
>> +    Result->addMapping(M.Local, M.Global);<br>
>> +  return llvm::cast<DebugSubsection>(std::move(Result));<br>
>> +}<br>
>> +<br>
>> +std::unique_ptr<DebugSubsection><br>
>> +YAMLCrossModuleImportsSubsection::toCodeViewSubsection(<br>
>> +    DebugStringTableSubsection *Strings,<br>
>> +    DebugChecksumsSubsection *Checksums) const {<br>
>> +  auto Result = llvm::make_unique<DebugCrossModuleImportsSubsection>(*Strings);<br>
>> +  for (const auto &M : Imports) {<br>
>> +    for (const auto Id : M.ImportIds)<br>
>> +      Result->addImport(M.ModuleName, Id);<br>
>> +  }<br>
>> +  return llvm::cast<DebugSubsection>(std::move(Result));<br>
>> +}<br>
>> +<br>
>>  static Expected<SourceFileChecksumEntry><br>
>>  convertOneChecksum(const DebugStringTableSubsectionRef &Strings,<br>
>>                     const FileChecksumEntry &CS) {<br>
>> @@ -391,6 +478,31 @@ YAMLInlineeLinesSubsection::fromCodeView<br>
>>    return Result;<br>
>>  }<br>
>><br>
>> +Expected<std::shared_ptr<YAMLCrossModuleExportsSubsection>><br>
>> +YAMLCrossModuleExportsSubsection::fromCodeViewSubsection(<br>
>> +    const DebugCrossModuleExportsSubsectionRef &Exports) {<br>
>> +  auto Result = std::make_shared<YAMLCrossModuleExportsSubsection>();<br>
>> +  Result->Exports.assign(Exports.begin(), Exports.end());<br>
>> +  return Result;<br>
>> +}<br>
>> +<br>
>> +Expected<std::shared_ptr<YAMLCrossModuleImportsSubsection>><br>
>> +YAMLCrossModuleImportsSubsection::fromCodeViewSubsection(<br>
>> +    const DebugStringTableSubsectionRef &Strings,<br>
>> +    const DebugCrossModuleImportsSubsectionRef &Imports) {<br>
>> +  auto Result = std::make_shared<YAMLCrossModuleImportsSubsection>();<br>
>> +  for (const auto &CMI : Imports) {<br>
>> +    YAMLCrossModuleImport YCMI;<br>
>> +    auto ExpectedStr = Strings.getString(CMI.Header->ModuleNameOffset);<br>
>> +    if (!ExpectedStr)<br>
>> +      return ExpectedStr.takeError();<br>
>> +    YCMI.ModuleName = *ExpectedStr;<br>
>> +    YCMI.ImportIds.assign(CMI.Imports.begin(), CMI.Imports.end());<br>
>> +    Result->Imports.push_back(YCMI);<br>
>> +  }<br>
>> +  return Result;<br>
>> +}<br>
>> +<br>
>>  Expected<std::vector<std::unique_ptr<DebugSubsection>>><br>
>>  llvm::CodeViewYAML::convertSubsectionList(<br>
>>      ArrayRef<YAMLDebugSubsection> Subsections,<br>
>> @@ -400,11 +512,11 @@ llvm::CodeViewYAML::convertSubsectionLis<br>
>>      return std::move(Result);<br>
>><br>
>>    auto Checksums = findChecksums(Subsections);<br>
>> -  if (!Checksums)<br>
>> -    return Checksums.takeError();<br>
>> -  auto ChecksumsBase = Checksums->toCodeViewSubsection(&Strings, nullptr);<br>
>> -  DebugChecksumsSubsection &CS =<br>
>> -      llvm::cast<DebugChecksumsSubsection>(*ChecksumsBase);<br>
>> +  std::unique_ptr<DebugSubsection> ChecksumsBase;<br>
>> +  if (Checksums)<br>
>> +    ChecksumsBase = Checksums->toCodeViewSubsection(&Strings, nullptr);<br>
>> +  DebugChecksumsSubsection *CS =<br>
>> +      static_cast<DebugChecksumsSubsection *>(ChecksumsBase.get());<br>
>>    for (const auto &SS : Subsections) {<br>
>>      // We've already converted the checksums subsection, don't do it<br>
>>      // twice.<br>
>> @@ -412,7 +524,8 @@ llvm::CodeViewYAML::convertSubsectionLis<br>
>>      if (SS.Subsection->Kind == DebugSubsectionKind::FileChecksums)<br>
>>        CVS = std::move(ChecksumsBase);<br>
>>      else<br>
>> -      CVS = SS.Subsection->toCodeViewSubsection(&Strings, &CS);<br>
>> +      CVS = SS.Subsection->toCodeViewSubsection(&Strings, CS);<br>
>> +    assert(CVS != nullptr);<br>
>>      Result.push_back(std::move(CVS));<br>
>>    }<br>
>>    return std::move(Result);<br>
>> @@ -429,6 +542,10 @@ struct SubsectionConversionVisitor : pub<br>
>>    Error visitLines(DebugLinesSubsectionRef &Lines) override;<br>
>>    Error visitFileChecksums(DebugChecksumsSubsectionRef &Checksums) override;<br>
>>    Error visitInlineeLines(DebugInlineeLinesSubsectionRef &Inlinees) override;<br>
>> +  Error visitCrossModuleExports(<br>
>> +      DebugCrossModuleExportsSubsectionRef &Checksums) override;<br>
>> +  Error visitCrossModuleImports(<br>
>> +      DebugCrossModuleImportsSubsectionRef &Inlinees) override;<br>
>><br>
>>    YAMLDebugSubsection Subsection;<br>
>><br>
>> @@ -468,6 +585,26 @@ Error SubsectionConversionVisitor::visit<br>
>>    if (!Result)<br>
>>      return Result.takeError();<br>
>>    Subsection.Subsection = *Result;<br>
>> +  return Error::success();<br>
>> +}<br>
>> +<br>
>> +Error SubsectionConversionVisitor::visitCrossModuleExports(<br>
>> +    DebugCrossModuleExportsSubsectionRef &Exports) {<br>
>> +  auto Result =<br>
>> +      YAMLCrossModuleExportsSubsection::fromCodeViewSubsection(Exports);<br>
>> +  if (!Result)<br>
>> +    return Result.takeError();<br>
>> +  Subsection.Subsection = *Result;<br>
>> +  return Error::success();<br>
>> +}<br>
>> +<br>
>> +Error SubsectionConversionVisitor::visitCrossModuleImports(<br>
>> +    DebugCrossModuleImportsSubsectionRef &Imports) {<br>
>> +  auto Result = YAMLCrossModuleImportsSubsection::fromCodeViewSubsection(<br>
>> +      Strings, Imports);<br>
>> +  if (!Result)<br>
>> +    return Result.takeError();<br>
>> +  Subsection.Subsection = *Result;<br>
>>    return Error::success();<br>
>>  }<br>
>>  }<br>
>><br>
>> Modified: llvm/trunk/lib/ObjectYAML/CodeViewYAMLSymbols.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/CodeViewYAMLSymbols.cpp?rev=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/CodeViewYAMLSymbols.cpp?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/ObjectYAML/CodeViewYAMLSymbols.cpp (original)<br>
>> +++ llvm/trunk/lib/ObjectYAML/CodeViewYAMLSymbols.cpp Mon Jun  5 16:40:33 2017<br>
>> @@ -47,6 +47,18 @@ LLVM_YAML_DECLARE_ENUM_TRAITS(RegisterId<br>
>>  LLVM_YAML_DECLARE_ENUM_TRAITS(TrampolineType)<br>
>>  LLVM_YAML_DECLARE_ENUM_TRAITS(ThunkOrdinal)<br>
>><br>
>> +LLVM_YAML_STRONG_TYPEDEF(llvm::StringRef, TypeName)<br>
>> +<br>
>> +LLVM_YAML_DECLARE_SCALAR_TRAITS(TypeName, true)<br>
>> +<br>
>> +StringRef ScalarTraits<TypeName>::input(StringRef S, void *V, TypeName &T) {<br>
>> +  return ScalarTraits<StringRef>::input(S, V, T.value);<br>
>> +}<br>
>> +void ScalarTraits<TypeName>::output(const TypeName &T, void *V,<br>
>> +                                    llvm::raw_ostream &R) {<br>
>> +  ScalarTraits<StringRef>::output(T.value, V, R);<br>
>> +}<br>
>> +<br>
>>  void ScalarEnumerationTraits<SymbolKind>::enumeration(IO &io,<br>
>>                                                        SymbolKind &Value) {<br>
>>    auto SymbolNames = getSymbolTypeNames();<br>
>> @@ -264,6 +276,7 @@ template <> void SymbolRecordImpl<Inline<br>
>>  template <> void SymbolRecordImpl<LocalSym>::map(IO &IO) {<br>
>>    IO.mapRequired("Type", Symbol.Type);<br>
>>    IO.mapRequired("Flags", Symbol.Flags);<br>
>> +<br>
>>    IO.mapRequired("VarName", Symbol.Name);<br>
>>  }<br>
>><br>
>><br>
>> Added: llvm/trunk/test/DebugInfo/PDB/Inputs/cross-module-import-export.yaml<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/Inputs/cross-module-import-export.yaml?rev=304738&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/Inputs/cross-module-import-export.yaml?rev=304738&view=auto</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/test/DebugInfo/PDB/Inputs/cross-module-import-export.yaml (added)<br>
>> +++ llvm/trunk/test/DebugInfo/PDB/Inputs/cross-module-import-export.yaml Mon Jun  5 16:40:33 2017<br>
>> @@ -0,0 +1,24 @@<br>
>> +DbiStream:<br>
>> +  Modules:<br>
>> +    - Module:          'Foo.obj'<br>
>> +      ObjFile:         'Foo.obj'<br>
>> +      Subsections:<br>
>> +        - !CrossModuleExports<br>
>> +          Exports:<br>
>> +            - LocalId:         4852<br>
>> +              GlobalId:        9283<br>
>> +            - LocalId:         <a href="tel:(214)%20748-7875" value="+12147487875" target="_blank">2147487875</a><br>
>> +              GlobalId:        9123<br>
>> +    - Module:          'Bar.obj'<br>
>> +      ObjFile:         'Bar.obj'<br>
>> +      Subsections:<br>
>> +        - !CrossModuleExports<br>
>> +          Exports:<br>
>> +            - LocalId:         4265<br>
>> +              GlobalId:        6097<br>
>> +            - LocalId:         4297<br>
>> +              GlobalId:        4677<br>
>> +        - !CrossModuleImports<br>
>> +          Imports:<br>
>> +            - Module:          'Foo.obj'<br>
>> +              Imports:         [ 4852, <a href="tel:(214)%20748-7875" value="+12147487875" target="_blank">2147487875</a> ]<br>
>><br>
>> Added: llvm/trunk/test/DebugInfo/PDB/cross-module-import-export.test<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/cross-module-import-export.test?rev=304738&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/cross-module-import-export.test?rev=304738&view=auto</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/test/DebugInfo/PDB/cross-module-import-export.test (added)<br>
>> +++ llvm/trunk/test/DebugInfo/PDB/cross-module-import-export.test Mon Jun  5 16:40:33 2017<br>
>> @@ -0,0 +1,60 @@<br>
>> +; RUN: llvm-pdbdump yaml2pdb -pdb=%t.pdb %p/Inputs/cross-module-import-export.yaml<br>
>> +<br>
>> +; RUN: llvm-pdbdump pdb2yaml -all -no-file-headers %t.pdb | FileCheck --check-prefix=YAML %s<br>
>> +; RUN: llvm-pdbdump raw -all %t.pdb | FileCheck --check-prefix=RAW %s<br>
>> +<br>
>> +YAML:      Modules:<br>
>> +YAML-NEXT:   - Module:          Foo.obj<br>
>> +YAML-NEXT:     ObjFile:         Foo.obj<br>
>> +YAML-NEXT:     Subsections:<br>
>> +YAML-NEXT:       - !CrossModuleExports<br>
>> +YAML-NEXT:         Exports:<br>
>> +YAML-NEXT:           - LocalId:         4852<br>
>> +YAML-NEXT:             GlobalId:        9283<br>
>> +YAML-NEXT:           - LocalId:         <a href="tel:(214)%20748-7875" value="+12147487875" target="_blank">2147487875</a><br>
>> +YAML-NEXT:             GlobalId:        9123<br>
>> +YAML:        - Module:          Bar.obj<br>
>> +YAML-NEXT:     ObjFile:         Bar.obj<br>
>> +YAML-NEXT:     Subsections:<br>
>> +YAML-NEXT:       - !CrossModuleExports<br>
>> +YAML-NEXT:         Exports:<br>
>> +YAML-NEXT:           - LocalId:         4265<br>
>> +YAML-NEXT:             GlobalId:        6097<br>
>> +YAML-NEXT:           - LocalId:         4297<br>
>> +YAML-NEXT:             GlobalId:        4677<br>
>> +YAML-NEXT:       - !CrossModuleImports<br>
>> +YAML-NEXT:         Imports:<br>
>> +YAML-NEXT:           - Module:          Foo.obj<br>
>> +YAML-NEXT:             Imports:         [ 4852, <a href="tel:(214)%20748-7875" value="+12147487875" target="_blank">2147487875</a> ]<br>
>> +<br>
>> +<br>
>> +RAW:      DBI Stream {<br>
>> +RAW:        Modules [<br>
>> +RAW-NEXT:     {<br>
>> +RAW-NEXT:       Name: Foo.obj<br>
>> +RAW:            LineInfo [<br>
>> +RAW-NEXT:         CrossModuleExports {<br>
>> +RAW-NEXT:           Local: 0x12F4<br>
>> +RAW-NEXT:           Global: 0x2443<br>
>> +RAW-NEXT:           Local: 0x80001083<br>
>> +RAW-NEXT:           Global: 0x23A3<br>
>> +RAW-NEXT:         }<br>
>> +RAW-NEXT:       ]<br>
>> +RAW-NEXT:     }<br>
>> +RAW-NEXT:     {<br>
>> +RAW-NEXT:       Name: Bar.obj<br>
>> +RAW:            LineInfo [<br>
>> +RAW-NEXT:         CrossModuleExports {<br>
>> +RAW-NEXT:           Local: 0x10A9<br>
>> +RAW-NEXT:           Global: 0x17D1<br>
>> +RAW-NEXT:           Local: 0x10C9<br>
>> +RAW-NEXT:           Global: 0x1245<br>
>> +RAW-NEXT:         }<br>
>> +RAW-NEXT:         CrossModuleImports {<br>
>> +RAW-NEXT:           Module: Foo.obj<br>
>> +RAW-NEXT:           Imports: [0x12F4, 0x80001083]<br>
>> +RAW-NEXT:         }<br>
>> +RAW-NEXT:       ]<br>
>> +RAW-NEXT:     }<br>
>> +RAW-NEXT:   ]<br>
>> +RAW-NEXT: }<br>
>> \ No newline at end of file<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=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.cpp?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.cpp (original)<br>
>> +++ llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.cpp Mon Jun  5 16:40:33 2017<br>
>> @@ -10,6 +10,8 @@<br>
>>  #include "C13DebugFragmentVisitor.h"<br>
>><br>
>>  #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"<br>
>> +#include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h"<br>
>> +#include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"<br>
>>  #include "llvm/DebugInfo/PDB/Native/PDBFile.h"<br>
>> @@ -48,18 +50,34 @@ Error C13DebugFragmentVisitor::visitInli<br>
>>    return Error::success();<br>
>>  }<br>
>><br>
>> +Error C13DebugFragmentVisitor::visitCrossModuleExports(<br>
>> +    codeview::DebugCrossModuleExportsSubsectionRef &Exports) {<br>
>> +  this->CrossExports.push_back(Exports);<br>
>> +  return Error::success();<br>
>> +}<br>
>> +<br>
>> +Error C13DebugFragmentVisitor::visitCrossModuleImports(<br>
>> +    codeview::DebugCrossModuleImportsSubsectionRef &Imports) {<br>
>> +  this->CrossImports.push_back(Imports);<br>
>> +  return Error::success();<br>
>> +}<br>
>> +<br>
>>  Error C13DebugFragmentVisitor::finished() {<br>
>> -  if (!Checksums.hasValue()) {<br>
>> -    assert(Lines.empty());<br>
>> -    return Error::success();<br>
>> +  if (Checksums.hasValue()) {<br>
>> +    if (auto EC = handleFileChecksums())<br>
>> +      return EC;<br>
>> +<br>
>> +    if (auto EC = handleLines())<br>
>> +      return EC;<br>
>> +<br>
>> +    if (auto EC = handleInlineeLines())<br>
>> +      return EC;<br>
>>    }<br>
>> -  if (auto EC = handleFileChecksums())<br>
>> -    return EC;<br>
>><br>
>> -  if (auto EC = handleLines())<br>
>> +  if (auto EC = handleCrossModuleExports())<br>
>>      return EC;<br>
>><br>
>> -  if (auto EC = handleInlineeLines())<br>
>> +  if (auto EC = handleCrossModuleImports())<br>
>>      return EC;<br>
>><br>
>>    return Error::success();<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=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.h?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.h (original)<br>
>> +++ llvm/trunk/tools/llvm-pdbdump/C13DebugFragmentVisitor.h Mon Jun  5 16:40:33 2017<br>
>> @@ -38,12 +38,20 @@ public:<br>
>>    Error<br>
>>    visitInlineeLines(codeview::DebugInlineeLinesSubsectionRef &Lines) final;<br>
>><br>
>> +  Error visitCrossModuleExports(<br>
>> +      codeview::DebugCrossModuleExportsSubsectionRef &Lines) final;<br>
>> +<br>
>> +  Error visitCrossModuleImports(<br>
>> +      codeview::DebugCrossModuleImportsSubsectionRef &Imports) 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>
>> +  virtual Error handleCrossModuleExports() { return Error::success(); }<br>
>> +  virtual Error handleCrossModuleImports() { return Error::success(); }<br>
>><br>
>>    Expected<StringRef> getNameFromStringTable(uint32_t Offset);<br>
>>    Expected<StringRef> getNameFromChecksumsBuffer(uint32_t Offset);<br>
>> @@ -51,6 +59,8 @@ protected:<br>
>>    Optional<codeview::DebugChecksumsSubsectionRef> Checksums;<br>
>>    std::vector<codeview::DebugInlineeLinesSubsectionRef> InlineeLines;<br>
>>    std::vector<codeview::DebugLinesSubsectionRef> Lines;<br>
>> +  std::vector<codeview::DebugCrossModuleExportsSubsectionRef> CrossExports;<br>
>> +  std::vector<codeview::DebugCrossModuleImportsSubsectionRef> CrossImports;<br>
>><br>
>>    PDBFile &F;<br>
>>  };<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=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.cpp?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.cpp (original)<br>
>> +++ llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.cpp Mon Jun  5 16:40:33 2017<br>
>> @@ -16,6 +16,8 @@<br>
>><br>
>>  #include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"<br>
>> +#include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h"<br>
>> +#include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h"<br>
>> @@ -172,6 +174,32 @@ public:<br>
>>        }<br>
>>      }<br>
>>      return Error::success();<br>
>> +  }<br>
>> +<br>
>> +  Error handleCrossModuleExports() override {<br>
>> +    for (const auto &M : CrossExports) {<br>
>> +      DictScope D(P, "CrossModuleExports");<br>
>> +      for (const auto &E : M) {<br>
>> +        P.printHex("Local", E.Local);<br>
>> +        P.printHex("Global", E.Global);<br>
>> +      }<br>
>> +    }<br>
>> +    return Error::success();<br>
>> +  }<br>
>> +<br>
>> +  Error handleCrossModuleImports() override {<br>
>> +    for (const auto &M : CrossImports) {<br>
>> +      DictScope D(P, "CrossModuleImports");<br>
>> +      for (const auto &ImportGroup : M) {<br>
>> +        auto Name =<br>
>> +            getNameFromStringTable(ImportGroup.Header->ModuleNameOffset);<br>
>> +        if (!Name)<br>
>> +          return Name.takeError();<br>
>> +        P.printString("Module", *Name);<br>
>> +        P.printHexList("Imports", ImportGroup.Imports);<br>
>> +      }<br>
>> +    }<br>
>> +    return Error::success();<br>
>>    }<br>
>><br>
>>  private:<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=304738&r1=304737&r2=304738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.cpp?rev=304738&r1=304737&r2=304738&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.cpp (original)<br>
>> +++ llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.cpp Mon Jun  5 16:40:33 2017<br>
>> @@ -17,7 +17,6 @@<br>
>>  #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugSubsection.h"<br>
>> -#include "llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h"<br>
>>  #include "llvm/DebugInfo/CodeView/DebugUnknownSubsection.h"<br>
>>  #include "llvm/DebugInfo/CodeView/Line.h"<br>
>>  #include "llvm/DebugInfo/MSF/MappedBlockStream.h"<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></blockquote></div>