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" |
| 11 | |
Adrian McCarthy | 4aedc81 | 2017-06-22 18:57:51 +0000 | [diff] [blame] | 12 | #include "llvm/ADT/STLExtras.h" |
| 13 | |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 14 | namespace llvm { |
| 15 | namespace pdb { |
| 16 | |
| 17 | NativeCompilandSymbol::NativeCompilandSymbol(NativeSession &Session, |
Adrian McCarthy | 8d090fc | 2017-07-12 19:38:11 +0000 | [diff] [blame] | 18 | SymIndexId SymbolId, |
Zachary Turner | 1eb9a02 | 2017-05-04 23:53:29 +0000 | [diff] [blame] | 19 | DbiModuleDescriptor MI) |
Adrian McCarthy | 31bcb6f | 2017-06-22 18:43:18 +0000 | [diff] [blame] | 20 | : NativeRawSymbol(Session, SymbolId), Module(MI) {} |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 21 | |
| 22 | PDB_SymType NativeCompilandSymbol::getSymTag() const { |
| 23 | return PDB_SymType::Compiland; |
| 24 | } |
| 25 | |
Adrian McCarthy | 31bcb6f | 2017-06-22 18:43:18 +0000 | [diff] [blame] | 26 | std::unique_ptr<NativeRawSymbol> NativeCompilandSymbol::clone() const { |
Adrian McCarthy | 4aedc81 | 2017-06-22 18:57:51 +0000 | [diff] [blame] | 27 | return llvm::make_unique<NativeCompilandSymbol>(Session, SymbolId, Module); |
Adrian McCarthy | 31bcb6f | 2017-06-22 18:43:18 +0000 | [diff] [blame] | 28 | } |
| 29 | |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 30 | bool NativeCompilandSymbol::isEditAndContinueEnabled() const { |
Zachary Turner | 1eb9a02 | 2017-05-04 23:53:29 +0000 | [diff] [blame] | 31 | return Module.hasECInfo(); |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | uint32_t NativeCompilandSymbol::getLexicalParentId() const { return 0; } |
| 35 | |
Adrian McCarthy | ad6d60a | 2017-03-15 20:29:06 +0000 | [diff] [blame] | 36 | // 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 McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 40 | |
| 41 | std::string NativeCompilandSymbol::getLibraryName() const { |
Zachary Turner | 1eb9a02 | 2017-05-04 23:53:29 +0000 | [diff] [blame] | 42 | return Module.getObjFileName(); |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | std::string NativeCompilandSymbol::getName() const { |
Zachary Turner | 1eb9a02 | 2017-05-04 23:53:29 +0000 | [diff] [blame] | 46 | return Module.getModuleName(); |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | } // namespace pdb |
| 50 | } // namespace llvm |