]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / DebugInfo / PDB / Native / NativeCompilandSymbol.cpp
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 NativeCompilandSymbol::NativeCompilandSymbol(NativeSession &Session,
19                                              SymIndexId SymbolId,
20                                              DbiModuleDescriptor MI)
21     : NativeRawSymbol(Session, PDB_SymType::Compiland, SymbolId), Module(MI) {}
22
23 PDB_SymType NativeCompilandSymbol::getSymTag() const {
24   return PDB_SymType::Compiland;
25 }
26
27 void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent,
28                                  PdbSymbolIdField ShowIdFields,
29                                  PdbSymbolIdField RecurseIdFields) const {
30   NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
31
32   dumpSymbolIdField(OS, "lexicalParentId", 0, Indent, Session,
33                     PdbSymbolIdField::LexicalParent, ShowIdFields,
34                     RecurseIdFields);
35   dumpSymbolField(OS, "libraryName", getLibraryName(), Indent);
36   dumpSymbolField(OS, "name", getName(), Indent);
37   dumpSymbolField(OS, "editAndContinueEnabled", isEditAndContinueEnabled(),
38                   Indent);
39 }
40
41 bool NativeCompilandSymbol::isEditAndContinueEnabled() const {
42   return Module.hasECInfo();
43 }
44
45 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 std::string NativeCompilandSymbol::getLibraryName() const {
53   return Module.getObjFileName();
54 }
55
56 std::string NativeCompilandSymbol::getName() const {
57   return Module.getModuleName();
58 }
59
60 } // namespace pdb
61 } // namespace llvm