NativeCompilandSymbol.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. namespace llvm {
  11. namespace pdb {
  12. NativeCompilandSymbol::NativeCompilandSymbol(NativeSession &Session,
  13. SymIndexId SymbolId,
  14. DbiModuleDescriptor MI)
  15. : NativeRawSymbol(Session, PDB_SymType::Compiland, SymbolId), Module(MI) {}
  16. PDB_SymType NativeCompilandSymbol::getSymTag() const {
  17. return PDB_SymType::Compiland;
  18. }
  19. void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent,
  20. PdbSymbolIdField ShowIdFields,
  21. PdbSymbolIdField RecurseIdFields) const {
  22. NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
  23. dumpSymbolIdField(OS, "lexicalParentId", 0, Indent, Session,
  24. PdbSymbolIdField::LexicalParent, ShowIdFields,
  25. RecurseIdFields);
  26. dumpSymbolField(OS, "libraryName", getLibraryName(), Indent);
  27. dumpSymbolField(OS, "name", getName(), Indent);
  28. dumpSymbolField(OS, "editAndContinueEnabled", isEditAndContinueEnabled(),
  29. Indent);
  30. }
  31. bool NativeCompilandSymbol::isEditAndContinueEnabled() const {
  32. return Module.hasECInfo();
  33. }
  34. SymIndexId NativeCompilandSymbol::getLexicalParentId() const { return 0; }
  35. // The usage of getObjFileName for getLibraryName and getModuleName for getName
  36. // may seem backwards, but it is consistent with DIA, which is what this API
  37. // was modeled after. We may rename these methods later to try to eliminate
  38. // this potential confusion.
  39. std::string NativeCompilandSymbol::getLibraryName() const {
  40. return std::string(Module.getObjFileName());
  41. }
  42. std::string NativeCompilandSymbol::getName() const {
  43. return std::string(Module.getModuleName());
  44. }
  45. } // namespace pdb
  46. } // namespace llvm