blob: b278526771fb69cd296e1e74554825aade9960a7 [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 McCarthy31bcb6f2017-06-22 18:43:18 +000036std::unique_ptr<NativeRawSymbol> NativeCompilandSymbol::clone() const {
Adrian McCarthy4aedc812017-06-22 18:57:51 +000037 return llvm::make_unique<NativeCompilandSymbol>(Session, SymbolId, Module);
Adrian McCarthy31bcb6f2017-06-22 18:43:18 +000038}
39
Adrian McCarthy65d26882017-03-15 20:17:58 +000040bool NativeCompilandSymbol::isEditAndContinueEnabled() const {
Zachary Turner1eb9a022017-05-04 23:53:29 +000041 return Module.hasECInfo();
Adrian McCarthy65d26882017-03-15 20:17:58 +000042}
43
Zachary Turnercae734582018-09-10 21:30:59 +000044SymIndexId NativeCompilandSymbol::getLexicalParentId() const { return 0; }
Adrian McCarthy65d26882017-03-15 20:17:58 +000045
Adrian McCarthyad6d60a2017-03-15 20:29:06 +000046// The usage of getObjFileName for getLibraryName and getModuleName for getName
47// may seem backwards, but it is consistent with DIA, which is what this API
48// was modeled after. We may rename these methods later to try to eliminate
49// this potential confusion.
Adrian McCarthy65d26882017-03-15 20:17:58 +000050
51std::string NativeCompilandSymbol::getLibraryName() const {
Zachary Turner1eb9a022017-05-04 23:53:29 +000052 return Module.getObjFileName();
Adrian McCarthy65d26882017-03-15 20:17:58 +000053}
54
55std::string NativeCompilandSymbol::getName() const {
Zachary Turner1eb9a022017-05-04 23:53:29 +000056 return Module.getModuleName();
Adrian McCarthy65d26882017-03-15 20:17:58 +000057}
58
59} // namespace pdb
60} // namespace llvm