blob: efa70b0e7bd8b18c3816ce77819275f716be1a42 [file] [log] [blame]
Adrian McCarthyad6d60a2017-03-15 20:29:06 +00001//===- NativeCompilandSymbol.cpp - Native impl for compilands ---*- C++ -*-===//
Adrian McCarthy65d26882017-03-15 20:17:58 +00002//
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"
Zachary Turnerc41ce832018-09-18 16:35:05 +000011#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
Adrian McCarthy65d26882017-03-15 20:17:58 +000012
Adrian McCarthy4aedc812017-06-22 18:57:51 +000013#include "llvm/ADT/STLExtras.h"
14
Adrian McCarthy65d26882017-03-15 20:17:58 +000015namespace llvm {
16namespace pdb {
17
18NativeCompilandSymbol::NativeCompilandSymbol(NativeSession &Session,
Adrian McCarthy8d090fc2017-07-12 19:38:11 +000019 SymIndexId SymbolId,
Zachary Turner1eb9a022017-05-04 23:53:29 +000020 DbiModuleDescriptor MI)
Zachary Turner7999b4f2018-09-05 23:30:38 +000021 : NativeRawSymbol(Session, PDB_SymType::Compiland, SymbolId), Module(MI) {}
Adrian McCarthy65d26882017-03-15 20:17:58 +000022
23PDB_SymType NativeCompilandSymbol::getSymTag() const {
24 return PDB_SymType::Compiland;
25}
26
Zachary Turnerc41ce832018-09-18 16:35:05 +000027void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent,
28 PdbSymbolIdField ShowIdFields,
29 PdbSymbolIdField RecurseIdFields) const {
30 NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
Zachary Turnerda4b63a2018-09-07 23:21:33 +000031
Zachary Turnerc41ce832018-09-18 16:35:05 +000032 dumpSymbolIdField(OS, "lexicalParentId", 0, Indent, Session,
33 PdbSymbolIdField::LexicalParent, ShowIdFields,
34 RecurseIdFields);
Zachary Turnerda4b63a2018-09-07 23:21:33 +000035 dumpSymbolField(OS, "libraryName", getLibraryName(), Indent);
36 dumpSymbolField(OS, "name", getName(), Indent);
37 dumpSymbolField(OS, "editAndContinueEnabled", isEditAndContinueEnabled(),
38 Indent);
39}
40
Adrian McCarthy65d26882017-03-15 20:17:58 +000041bool NativeCompilandSymbol::isEditAndContinueEnabled() const {
Zachary Turner1eb9a022017-05-04 23:53:29 +000042 return Module.hasECInfo();
Adrian McCarthy65d26882017-03-15 20:17:58 +000043}
44
Zachary Turnercae734582018-09-10 21:30:59 +000045SymIndexId NativeCompilandSymbol::getLexicalParentId() const { return 0; }
Adrian McCarthy65d26882017-03-15 20:17:58 +000046
Adrian McCarthyad6d60a2017-03-15 20:29:06 +000047// The usage of getObjFileName for getLibraryName and getModuleName for getName
48// may seem backwards, but it is consistent with DIA, which is what this API
49// was modeled after. We may rename these methods later to try to eliminate
50// this potential confusion.
Adrian McCarthy65d26882017-03-15 20:17:58 +000051
52std::string NativeCompilandSymbol::getLibraryName() const {
Zachary Turner1eb9a022017-05-04 23:53:29 +000053 return Module.getObjFileName();
Adrian McCarthy65d26882017-03-15 20:17:58 +000054}
55
56std::string NativeCompilandSymbol::getName() const {
Zachary Turner1eb9a022017-05-04 23:53:29 +000057 return Module.getModuleName();
Adrian McCarthy65d26882017-03-15 20:17:58 +000058}
59
60} // namespace pdb
61} // namespace llvm