blob: 64ddf75c6d242cf0859fd30c81087b31564f8087 [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"
11
Adrian McCarthy4aedc812017-06-22 18:57:51 +000012#include "llvm/ADT/STLExtras.h"
13
Adrian McCarthy65d26882017-03-15 20:17:58 +000014namespace llvm {
15namespace pdb {
16
17NativeCompilandSymbol::NativeCompilandSymbol(NativeSession &Session,
Adrian McCarthy8d090fc2017-07-12 19:38:11 +000018 SymIndexId SymbolId,
Zachary Turner1eb9a022017-05-04 23:53:29 +000019 DbiModuleDescriptor MI)
Zachary Turner7999b4f2018-09-05 23:30:38 +000020 : NativeRawSymbol(Session, PDB_SymType::Compiland, SymbolId), Module(MI) {}
Adrian McCarthy65d26882017-03-15 20:17:58 +000021
22PDB_SymType NativeCompilandSymbol::getSymTag() const {
23 return PDB_SymType::Compiland;
24}
25
Zachary Turnerda4b63a2018-09-07 23:21:33 +000026void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent) const {
27 NativeRawSymbol::dump(OS, Indent);
28
Zachary Turnerda4b63a2018-09-07 23:21:33 +000029 dumpSymbolField(OS, "lexicalParentId", 0, Indent);
30 dumpSymbolField(OS, "libraryName", getLibraryName(), Indent);
31 dumpSymbolField(OS, "name", getName(), Indent);
32 dumpSymbolField(OS, "editAndContinueEnabled", isEditAndContinueEnabled(),
33 Indent);
34}
35
Adrian McCarthy65d26882017-03-15 20:17:58 +000036bool NativeCompilandSymbol::isEditAndContinueEnabled() const {
Zachary Turner1eb9a022017-05-04 23:53:29 +000037 return Module.hasECInfo();
Adrian McCarthy65d26882017-03-15 20:17:58 +000038}
39
Zachary Turnercae734582018-09-10 21:30:59 +000040SymIndexId NativeCompilandSymbol::getLexicalParentId() const { return 0; }
Adrian McCarthy65d26882017-03-15 20:17:58 +000041
Adrian McCarthyad6d60a2017-03-15 20:29:06 +000042// The usage of getObjFileName for getLibraryName and getModuleName for getName
43// may seem backwards, but it is consistent with DIA, which is what this API
44// was modeled after. We may rename these methods later to try to eliminate
45// this potential confusion.
Adrian McCarthy65d26882017-03-15 20:17:58 +000046
47std::string NativeCompilandSymbol::getLibraryName() const {
Zachary Turner1eb9a022017-05-04 23:53:29 +000048 return Module.getObjFileName();
Adrian McCarthy65d26882017-03-15 20:17:58 +000049}
50
51std::string NativeCompilandSymbol::getName() const {
Zachary Turner1eb9a022017-05-04 23:53:29 +000052 return Module.getModuleName();
Adrian McCarthy65d26882017-03-15 20:17:58 +000053}
54
55} // namespace pdb
56} // namespace llvm