Adrian McCarthy | ad6d60a | 2017-03-15 20:29:06 +0000 | [diff] [blame] | 1 | //===- NativeCompilandSymbol.cpp - Native impl for compilands ---*- C++ -*-===// |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 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" |
Zachary Turner | c41ce83 | 2018-09-18 16:35:05 +0000 | [diff] [blame^] | 11 | #include "llvm/DebugInfo/PDB/Native/NativeSession.h" |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 12 | |
Adrian McCarthy | 4aedc81 | 2017-06-22 18:57:51 +0000 | [diff] [blame] | 13 | #include "llvm/ADT/STLExtras.h" |
| 14 | |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 15 | namespace llvm { |
| 16 | namespace pdb { |
| 17 | |
| 18 | NativeCompilandSymbol::NativeCompilandSymbol(NativeSession &Session, |
Adrian McCarthy | 8d090fc | 2017-07-12 19:38:11 +0000 | [diff] [blame] | 19 | SymIndexId SymbolId, |
Zachary Turner | 1eb9a02 | 2017-05-04 23:53:29 +0000 | [diff] [blame] | 20 | DbiModuleDescriptor MI) |
Zachary Turner | 7999b4f | 2018-09-05 23:30:38 +0000 | [diff] [blame] | 21 | : NativeRawSymbol(Session, PDB_SymType::Compiland, SymbolId), Module(MI) {} |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 22 | |
| 23 | PDB_SymType NativeCompilandSymbol::getSymTag() const { |
| 24 | return PDB_SymType::Compiland; |
| 25 | } |
| 26 | |
Zachary Turner | c41ce83 | 2018-09-18 16:35:05 +0000 | [diff] [blame^] | 27 | void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent, |
| 28 | PdbSymbolIdField ShowIdFields, |
| 29 | PdbSymbolIdField RecurseIdFields) const { |
| 30 | NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields); |
Zachary Turner | da4b63a | 2018-09-07 23:21:33 +0000 | [diff] [blame] | 31 | |
Zachary Turner | c41ce83 | 2018-09-18 16:35:05 +0000 | [diff] [blame^] | 32 | dumpSymbolIdField(OS, "lexicalParentId", 0, Indent, Session, |
| 33 | PdbSymbolIdField::LexicalParent, ShowIdFields, |
| 34 | RecurseIdFields); |
Zachary Turner | da4b63a | 2018-09-07 23:21:33 +0000 | [diff] [blame] | 35 | dumpSymbolField(OS, "libraryName", getLibraryName(), Indent); |
| 36 | dumpSymbolField(OS, "name", getName(), Indent); |
| 37 | dumpSymbolField(OS, "editAndContinueEnabled", isEditAndContinueEnabled(), |
| 38 | Indent); |
| 39 | } |
| 40 | |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 41 | bool NativeCompilandSymbol::isEditAndContinueEnabled() const { |
Zachary Turner | 1eb9a02 | 2017-05-04 23:53:29 +0000 | [diff] [blame] | 42 | return Module.hasECInfo(); |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 43 | } |
| 44 | |
Zachary Turner | cae73458 | 2018-09-10 21:30:59 +0000 | [diff] [blame] | 45 | SymIndexId NativeCompilandSymbol::getLexicalParentId() const { return 0; } |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 46 | |
Adrian McCarthy | ad6d60a | 2017-03-15 20:29:06 +0000 | [diff] [blame] | 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. |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 51 | |
| 52 | std::string NativeCompilandSymbol::getLibraryName() const { |
Zachary Turner | 1eb9a02 | 2017-05-04 23:53:29 +0000 | [diff] [blame] | 53 | return Module.getObjFileName(); |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | std::string NativeCompilandSymbol::getName() const { |
Zachary Turner | 1eb9a02 | 2017-05-04 23:53:29 +0000 | [diff] [blame] | 57 | return Module.getModuleName(); |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | } // namespace pdb |
| 61 | } // namespace llvm |