17a7e6055SDimitry Andric //===- NativeCompilandSymbol.cpp - Native impl for compilands ---*- C++ -*-===//
27a7e6055SDimitry Andric //
37a7e6055SDimitry Andric // The LLVM Compiler Infrastructure
47a7e6055SDimitry Andric //
57a7e6055SDimitry Andric // This file is distributed under the University of Illinois Open Source
67a7e6055SDimitry Andric // License. See LICENSE.TXT for details.
77a7e6055SDimitry Andric //
87a7e6055SDimitry Andric //===----------------------------------------------------------------------===//
97a7e6055SDimitry Andric
107a7e6055SDimitry Andric #include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
11*b5893f02SDimitry Andric #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
127a7e6055SDimitry Andric
13edd7eaddSDimitry Andric #include "llvm/ADT/STLExtras.h"
14edd7eaddSDimitry Andric
157a7e6055SDimitry Andric namespace llvm {
167a7e6055SDimitry Andric namespace pdb {
177a7e6055SDimitry Andric
NativeCompilandSymbol(NativeSession & Session,SymIndexId SymbolId,DbiModuleDescriptor MI)187a7e6055SDimitry Andric NativeCompilandSymbol::NativeCompilandSymbol(NativeSession &Session,
19c4394386SDimitry Andric SymIndexId SymbolId,
200f5676f4SDimitry Andric DbiModuleDescriptor MI)
21*b5893f02SDimitry Andric : NativeRawSymbol(Session, PDB_SymType::Compiland, SymbolId), Module(MI) {}
227a7e6055SDimitry Andric
getSymTag() const237a7e6055SDimitry Andric PDB_SymType NativeCompilandSymbol::getSymTag() const {
247a7e6055SDimitry Andric return PDB_SymType::Compiland;
257a7e6055SDimitry Andric }
267a7e6055SDimitry Andric
dump(raw_ostream & OS,int Indent,PdbSymbolIdField ShowIdFields,PdbSymbolIdField RecurseIdFields) const27*b5893f02SDimitry Andric void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent,
28*b5893f02SDimitry Andric PdbSymbolIdField ShowIdFields,
29*b5893f02SDimitry Andric PdbSymbolIdField RecurseIdFields) const {
30*b5893f02SDimitry Andric NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
31*b5893f02SDimitry Andric
32*b5893f02SDimitry Andric dumpSymbolIdField(OS, "lexicalParentId", 0, Indent, Session,
33*b5893f02SDimitry Andric PdbSymbolIdField::LexicalParent, ShowIdFields,
34*b5893f02SDimitry Andric RecurseIdFields);
35*b5893f02SDimitry Andric dumpSymbolField(OS, "libraryName", getLibraryName(), Indent);
36*b5893f02SDimitry Andric dumpSymbolField(OS, "name", getName(), Indent);
37*b5893f02SDimitry Andric dumpSymbolField(OS, "editAndContinueEnabled", isEditAndContinueEnabled(),
38*b5893f02SDimitry Andric Indent);
39edd7eaddSDimitry Andric }
40edd7eaddSDimitry Andric
isEditAndContinueEnabled() const417a7e6055SDimitry Andric bool NativeCompilandSymbol::isEditAndContinueEnabled() const {
420f5676f4SDimitry Andric return Module.hasECInfo();
437a7e6055SDimitry Andric }
447a7e6055SDimitry Andric
getLexicalParentId() const45*b5893f02SDimitry Andric SymIndexId NativeCompilandSymbol::getLexicalParentId() const { return 0; }
467a7e6055SDimitry Andric
477a7e6055SDimitry Andric // The usage of getObjFileName for getLibraryName and getModuleName for getName
487a7e6055SDimitry Andric // may seem backwards, but it is consistent with DIA, which is what this API
497a7e6055SDimitry Andric // was modeled after. We may rename these methods later to try to eliminate
507a7e6055SDimitry Andric // this potential confusion.
517a7e6055SDimitry Andric
getLibraryName() const527a7e6055SDimitry Andric std::string NativeCompilandSymbol::getLibraryName() const {
530f5676f4SDimitry Andric return Module.getObjFileName();
547a7e6055SDimitry Andric }
557a7e6055SDimitry Andric
getName() const567a7e6055SDimitry Andric std::string NativeCompilandSymbol::getName() const {
570f5676f4SDimitry Andric return Module.getModuleName();
587a7e6055SDimitry Andric }
597a7e6055SDimitry Andric
607a7e6055SDimitry Andric } // namespace pdb
617a7e6055SDimitry Andric } // namespace llvm
62