Line data Source code
1 : //===- NativeCompilandSymbol.cpp - Native impl for compilands ---*- C++ -*-===//
2 : //
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 : #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
12 :
13 : #include "llvm/ADT/STLExtras.h"
14 :
15 : namespace llvm {
16 : namespace pdb {
17 :
18 56 : NativeCompilandSymbol::NativeCompilandSymbol(NativeSession &Session,
19 : SymIndexId SymbolId,
20 56 : DbiModuleDescriptor MI)
21 56 : : NativeRawSymbol(Session, PDB_SymType::Compiland, SymbolId), Module(MI) {}
22 :
23 186 : PDB_SymType NativeCompilandSymbol::getSymTag() const {
24 186 : return PDB_SymType::Compiland;
25 : }
26 :
27 2 : void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent,
28 : PdbSymbolIdField ShowIdFields,
29 : PdbSymbolIdField RecurseIdFields) const {
30 2 : NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
31 :
32 4 : dumpSymbolIdField(OS, "lexicalParentId", 0, Indent, Session,
33 : PdbSymbolIdField::LexicalParent, ShowIdFields,
34 : RecurseIdFields);
35 2 : dumpSymbolField(OS, "libraryName", getLibraryName(), Indent);
36 2 : dumpSymbolField(OS, "name", getName(), Indent);
37 2 : dumpSymbolField(OS, "editAndContinueEnabled", isEditAndContinueEnabled(),
38 : Indent);
39 2 : }
40 :
41 2 : bool NativeCompilandSymbol::isEditAndContinueEnabled() const {
42 2 : return Module.hasECInfo();
43 : }
44 :
45 0 : SymIndexId NativeCompilandSymbol::getLexicalParentId() const { return 0; }
46 :
47 : // 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.
51 :
52 2 : std::string NativeCompilandSymbol::getLibraryName() const {
53 2 : return Module.getObjFileName();
54 : }
55 :
56 52 : std::string NativeCompilandSymbol::getName() const {
57 52 : return Module.getModuleName();
58 : }
59 :
60 : } // namespace pdb
61 : } // namespace llvm
|