blob: 7132a99a9f160191e05816dde46dc194b58a82ad [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)
Adrian McCarthy31bcb6f2017-06-22 18:43:18 +000020 : NativeRawSymbol(Session, SymbolId), Module(MI) {}
Adrian McCarthy65d26882017-03-15 20:17:58 +000021
22PDB_SymType NativeCompilandSymbol::getSymTag() const {
23 return PDB_SymType::Compiland;
24}
25
Adrian McCarthy31bcb6f2017-06-22 18:43:18 +000026std::unique_ptr<NativeRawSymbol> NativeCompilandSymbol::clone() const {
Adrian McCarthy4aedc812017-06-22 18:57:51 +000027 return llvm::make_unique<NativeCompilandSymbol>(Session, SymbolId, Module);
Adrian McCarthy31bcb6f2017-06-22 18:43:18 +000028}
29
Adrian McCarthy65d26882017-03-15 20:17:58 +000030bool NativeCompilandSymbol::isEditAndContinueEnabled() const {
Zachary Turner1eb9a022017-05-04 23:53:29 +000031 return Module.hasECInfo();
Adrian McCarthy65d26882017-03-15 20:17:58 +000032}
33
34uint32_t NativeCompilandSymbol::getLexicalParentId() const { return 0; }
35
Adrian McCarthyad6d60a2017-03-15 20:29:06 +000036// The usage of getObjFileName for getLibraryName and getModuleName for getName
37// may seem backwards, but it is consistent with DIA, which is what this API
38// was modeled after. We may rename these methods later to try to eliminate
39// this potential confusion.
Adrian McCarthy65d26882017-03-15 20:17:58 +000040
41std::string NativeCompilandSymbol::getLibraryName() const {
Zachary Turner1eb9a022017-05-04 23:53:29 +000042 return Module.getObjFileName();
Adrian McCarthy65d26882017-03-15 20:17:58 +000043}
44
45std::string NativeCompilandSymbol::getName() const {
Zachary Turner1eb9a022017-05-04 23:53:29 +000046 return Module.getModuleName();
Adrian McCarthy65d26882017-03-15 20:17:58 +000047}
48
49} // namespace pdb
50} // namespace llvm