Zachary Turner | 21473f7 | 2015-02-08 00:29:29 +0000 | [diff] [blame] | 1 | //===- PDBSymbolCompiland.cpp - compiland details --------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
Zachary Turner | 52c9f88 | 2015-02-14 03:53:56 +0000 | [diff] [blame] | 10 | #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h" |
| 11 | |
Zachary Turner | 21473f7 | 2015-02-08 00:29:29 +0000 | [diff] [blame] | 12 | #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" |
Zachary Turner | a554917 | 2015-02-10 22:43:25 +0000 | [diff] [blame] | 13 | #include "llvm/DebugInfo/PDB/IPDBSession.h" |
| 14 | #include "llvm/DebugInfo/PDB/IPDBSourceFile.h" |
| 15 | #include "llvm/DebugInfo/PDB/PDBExtras.h" |
Zachary Turner | 21473f7 | 2015-02-08 00:29:29 +0000 | [diff] [blame] | 16 | #include "llvm/DebugInfo/PDB/PDBSymbol.h" |
Zachary Turner | 21473f7 | 2015-02-08 00:29:29 +0000 | [diff] [blame] | 17 | #include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h" |
Zachary Turner | a554917 | 2015-02-10 22:43:25 +0000 | [diff] [blame] | 18 | #include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h" |
Zachary Turner | c074de0 | 2015-02-12 21:09:24 +0000 | [diff] [blame] | 19 | #include "llvm/Support/Path.h" |
Chandler Carruth | 71f308a | 2015-02-13 09:09:03 +0000 | [diff] [blame] | 20 | #include "llvm/Support/raw_ostream.h" |
Zachary Turner | 52c9f88 | 2015-02-14 03:53:56 +0000 | [diff] [blame] | 21 | |
Chandler Carruth | 71f308a | 2015-02-13 09:09:03 +0000 | [diff] [blame] | 22 | #include <utility> |
| 23 | #include <vector> |
Zachary Turner | 21473f7 | 2015-02-08 00:29:29 +0000 | [diff] [blame] | 24 | |
| 25 | using namespace llvm; |
| 26 | |
Zachary Turner | 98571ed | 2015-02-08 22:53:53 +0000 | [diff] [blame] | 27 | PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession, |
Zachary Turner | bae16b3 | 2015-02-08 20:58:09 +0000 | [diff] [blame] | 28 | std::unique_ptr<IPDBRawSymbol> Symbol) |
| 29 | : PDBSymbol(PDBSession, std::move(Symbol)) {} |
Zachary Turner | 21473f7 | 2015-02-08 00:29:29 +0000 | [diff] [blame] | 30 | |
Zachary Turner | c0acf68 | 2015-02-15 20:27:53 +0000 | [diff] [blame] | 31 | #define SKIP_SYMBOL_IF_FLAG_UNSET(Tag, Flag) \ |
| 32 | case PDB_SymType::Tag: \ |
| 33 | if ((Flags & Flag) == 0) \ |
| 34 | continue; \ |
| 35 | break; |
| 36 | |
Zachary Turner | a554917 | 2015-02-10 22:43:25 +0000 | [diff] [blame] | 37 | void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent, |
Zachary Turner | c0acf68 | 2015-02-15 20:27:53 +0000 | [diff] [blame] | 38 | PDB_DumpLevel Level, PDB_DumpFlags Flags) const { |
Zachary Turner | a952c49 | 2015-02-13 07:40:03 +0000 | [diff] [blame] | 39 | if (Level == PDB_DumpLevel::Detailed) { |
| 40 | std::string FullName = getName(); |
Zachary Turner | c0acf68 | 2015-02-15 20:27:53 +0000 | [diff] [blame] | 41 | OS << stream_indent(Indent) << FullName; |
| 42 | if (Flags & PDB_DF_Children) { |
| 43 | if (Level >= PDB_DumpLevel::Detailed) { |
| 44 | auto ChildrenEnum = findAllChildren(); |
| 45 | while (auto Child = ChildrenEnum->getNext()) { |
| 46 | switch (Child->getSymTag()) { |
| 47 | SKIP_SYMBOL_IF_FLAG_UNSET(Function, PDB_DF_Functions) |
| 48 | SKIP_SYMBOL_IF_FLAG_UNSET(Data, PDB_DF_Data) |
| 49 | SKIP_SYMBOL_IF_FLAG_UNSET(Label, PDB_DF_Labels) |
| 50 | SKIP_SYMBOL_IF_FLAG_UNSET(PublicSymbol, PDB_DF_PublicSyms) |
| 51 | SKIP_SYMBOL_IF_FLAG_UNSET(UDT, PDB_DF_Classes) |
| 52 | SKIP_SYMBOL_IF_FLAG_UNSET(Enum, PDB_DF_Enums) |
| 53 | SKIP_SYMBOL_IF_FLAG_UNSET(FunctionSig, PDB_DF_Funcsigs) |
| 54 | SKIP_SYMBOL_IF_FLAG_UNSET(VTable, PDB_DF_VTables) |
| 55 | SKIP_SYMBOL_IF_FLAG_UNSET(Thunk, PDB_DF_Thunks) |
| 56 | SKIP_SYMBOL_IF_FLAG_UNSET(Compiland, PDB_DF_ObjFiles) |
| 57 | default: |
| 58 | continue; |
| 59 | } |
| 60 | PDB_DumpLevel ChildLevel = (Level == PDB_DumpLevel::Detailed) |
| 61 | ? PDB_DumpLevel::Normal |
| 62 | : PDB_DumpLevel::Compact; |
| 63 | OS << "\n"; |
| 64 | Child->dump(OS, Indent + 2, ChildLevel, PDB_DF_Children); |
| 65 | } |
Zachary Turner | a952c49 | 2015-02-13 07:40:03 +0000 | [diff] [blame] | 66 | } |
Zachary Turner | a554917 | 2015-02-10 22:43:25 +0000 | [diff] [blame] | 67 | } |
Zachary Turner | a952c49 | 2015-02-13 07:40:03 +0000 | [diff] [blame] | 68 | } else { |
| 69 | std::string FullName = getName(); |
| 70 | OS << stream_indent(Indent) << "Compiland: " << FullName; |
Zachary Turner | a554917 | 2015-02-10 22:43:25 +0000 | [diff] [blame] | 71 | } |
Zachary Turner | 21473f7 | 2015-02-08 00:29:29 +0000 | [diff] [blame] | 72 | } |