1 //===- NativeCompilandSymbol.cpp - Native impl for compilands ---*- 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 10 #include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h" 11 12 #include "llvm/ADT/STLExtras.h" 13 14 namespace llvm { 15 namespace pdb { 16 17 NativeCompilandSymbol::NativeCompilandSymbol(NativeSession &Session, 18 SymIndexId SymbolId, 19 DbiModuleDescriptor MI) 20 : NativeRawSymbol(Session, PDB_SymType::Compiland, SymbolId), Module(MI) {} 21 22 PDB_SymType NativeCompilandSymbol::getSymTag() const { 23 return PDB_SymType::Compiland; 24 } 25 26 void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent) const { 27 NativeRawSymbol::dump(OS, Indent); 28 29 dumpSymbolField(OS, "baseType", static_cast<uint32_t>(getBuiltinType()), 30 Indent); 31 dumpSymbolField(OS, "lexicalParentId", 0, Indent); 32 dumpSymbolField(OS, "libraryName", getLibraryName(), Indent); 33 dumpSymbolField(OS, "name", getName(), Indent); 34 dumpSymbolField(OS, "editAndContinueEnabled", isEditAndContinueEnabled(), 35 Indent); 36 } 37 38 std::unique_ptr<NativeRawSymbol> NativeCompilandSymbol::clone() const { 39 return llvm::make_unique<NativeCompilandSymbol>(Session, SymbolId, Module); 40 } 41 42 bool NativeCompilandSymbol::isEditAndContinueEnabled() const { 43 return Module.hasECInfo(); 44 } 45 46 uint32_t NativeCompilandSymbol::getLexicalParentId() const { return 0; } 47 48 // The usage of getObjFileName for getLibraryName and getModuleName for getName 49 // may seem backwards, but it is consistent with DIA, which is what this API 50 // was modeled after. We may rename these methods later to try to eliminate 51 // this potential confusion. 52 53 std::string NativeCompilandSymbol::getLibraryName() const { 54 return Module.getObjFileName(); 55 } 56 57 std::string NativeCompilandSymbol::getName() const { 58 return Module.getModuleName(); 59 } 60 61 } // namespace pdb 62 } // namespace llvm 63