[LLVMDebugInfoPDB] - Use cantFail() instead of assert().
[llvm-core.git] / lib / DebugInfo / PDB / Native / NativeCompilandSymbol.cpp
blob39ae84acba20218f137e9b9e1680ec437da8a281
1 //===- NativeCompilandSymbol.cpp - Native impl for compilands ---*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
10 #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
12 #include "llvm/ADT/STLExtras.h"
14 namespace llvm {
15 namespace pdb {
17 NativeCompilandSymbol::NativeCompilandSymbol(NativeSession &Session,
18 SymIndexId SymbolId,
19 DbiModuleDescriptor MI)
20 : NativeRawSymbol(Session, PDB_SymType::Compiland, SymbolId), Module(MI) {}
22 PDB_SymType NativeCompilandSymbol::getSymTag() const {
23 return PDB_SymType::Compiland;
26 void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent,
27 PdbSymbolIdField ShowIdFields,
28 PdbSymbolIdField RecurseIdFields) const {
29 NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
31 dumpSymbolIdField(OS, "lexicalParentId", 0, Indent, Session,
32 PdbSymbolIdField::LexicalParent, ShowIdFields,
33 RecurseIdFields);
34 dumpSymbolField(OS, "libraryName", getLibraryName(), Indent);
35 dumpSymbolField(OS, "name", getName(), Indent);
36 dumpSymbolField(OS, "editAndContinueEnabled", isEditAndContinueEnabled(),
37 Indent);
40 bool NativeCompilandSymbol::isEditAndContinueEnabled() const {
41 return Module.hasECInfo();
44 SymIndexId NativeCompilandSymbol::getLexicalParentId() const { return 0; }
46 // The usage of getObjFileName for getLibraryName and getModuleName for getName
47 // may seem backwards, but it is consistent with DIA, which is what this API
48 // was modeled after. We may rename these methods later to try to eliminate
49 // this potential confusion.
51 std::string NativeCompilandSymbol::getLibraryName() const {
52 return Module.getObjFileName();
55 std::string NativeCompilandSymbol::getName() const {
56 return Module.getModuleName();
59 } // namespace pdb
60 } // namespace llvm