NativeCompilandSymbol.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. //===----------------------------------------------------------------------===//
  8. #include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
  9. #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
  10. #include "llvm/ADT/STLExtras.h"
  11. namespace llvm {
  12. namespace pdb {
  13. NativeCompilandSymbol::NativeCompilandSymbol(NativeSession &Session,
  14. SymIndexId SymbolId,
  15. DbiModuleDescriptor MI)
  16. : NativeRawSymbol(Session, PDB_SymType::Compiland, SymbolId), Module(MI) {}
  17. PDB_SymType NativeCompilandSymbol::getSymTag() const {
  18. return PDB_SymType::Compiland;
  19. }
  20. void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent,
  21. PdbSymbolIdField ShowIdFields,
  22. PdbSymbolIdField RecurseIdFields) const {
  23. NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
  24. dumpSymbolIdField(OS, "lexicalParentId", 0, Indent, Session,
  25. PdbSymbolIdField::LexicalParent, ShowIdFields,
  26. RecurseIdFields);
  27. dumpSymbolField(OS, "libraryName", getLibraryName(), Indent);
  28. dumpSymbolField(OS, "name", getName(), Indent);
  29. dumpSymbolField(OS, "editAndContinueEnabled", isEditAndContinueEnabled(),
  30. Indent);
  31. }
  32. bool NativeCompilandSymbol::isEditAndContinueEnabled() const {
  33. return Module.hasECInfo();
  34. }
  35. SymIndexId NativeCompilandSymbol::getLexicalParentId() const { return 0; }
  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.
  40. std::string NativeCompilandSymbol::getLibraryName() const {
  41. return std::string(Module.getObjFileName());
  42. }
  43. std::string NativeCompilandSymbol::getName() const {
  44. return std::string(Module.getModuleName());
  45. }
  46. } // namespace pdb
  47. } // namespace llvm