BlCvTypeSource.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #pragma once
  2. #include "../Beef/BfCommon.h"
  3. #include "BeefySysLib/FileStream.h"
  4. #include "BeefySysLib/util/BumpAllocator.h"
  5. #include "BeefySysLib/util/Hash.h"
  6. #include "BeefySysLib/util/CritSect.h"
  7. #include "../Compiler/BfUtil.h"
  8. #include <unordered_map>
  9. NS_BF_BEGIN
  10. class BlPdbParser;
  11. class BlTypeInfo;
  12. class BlCompositeType;
  13. class BlCodeView;
  14. class BlType;
  15. class BlStructType;
  16. class BlProcType;
  17. class BlCvTypeInfoExt
  18. {
  19. public:
  20. int mMasterTag;
  21. int mMemberMasterTag;
  22. };
  23. enum BlTypeMapFlag
  24. {
  25. BlTypeMapFlag_InfoExt_ProcId_TypeOnly = 0x80000000,
  26. BlTypeMapFlag_InfoExt_ProcId_Resolved = 0x40000000,
  27. BlTypeMapFlag_InfoExt_MASK = 0x0FFFFFFF
  28. };
  29. class BlCvTypeContainer
  30. {
  31. public:
  32. int mCvMinTag;
  33. int mCvMaxTag;
  34. // Negative values in mTagMap are contextual:
  35. // For LF_FUNC_ID, refers to embedded FunctionType
  36. std::vector<int> mTagMap;
  37. std::vector<int> mElementMap; // From FUNC_ID to FuncType, for example
  38. std::vector<int> mCvTagStartMap;
  39. uint8* mSectionData;
  40. int mSectionSize;
  41. BlCodeView* mCodeView;
  42. BlTypeInfo* mOutTypeInfo;
  43. std::vector<int>* mTPIMap;
  44. std::vector<int>* mIPIMap;
  45. int mIdx;
  46. //std::vector<BlCvTypeInfoExt> mInfoExts;
  47. public:
  48. void NotImpl();
  49. void Fail(const StringImpl& err);
  50. const char* CvParseAndDupString(uint8 *& data, bool hasUniqueName = false);
  51. int CreateMasterTag(int tagId, BlTypeInfo* outTypeInfo);
  52. void HashName(const char* namePtr, bool hasMangledName, HashContext& hashContext);
  53. void HashTPITag(int tagId, HashContext& hashContext);
  54. void HashIPITag(int tagId, HashContext& hashContext);
  55. void HashTagContent(int tagId, HashContext& hashContext, bool& isIPI);
  56. void ParseTag(int tagId, bool forceFull = false);
  57. public:
  58. BlCvTypeContainer();
  59. ~BlCvTypeContainer();
  60. int GetMasterTPITag(int tagId);
  61. int GetMasterIPITag(int tagId);
  62. void ScanTypeData();
  63. void ParseTypeData();
  64. };
  65. class BlObjectData;
  66. class BlCvTypeSource
  67. {
  68. public:
  69. BlPdbParser* mTypeServerLib;
  70. BlObjectData* mObjectData;
  71. BlCvTypeContainer mTPI;
  72. BlCvTypeContainer* mIPI;
  73. volatile bool mIsDone;
  74. public:
  75. BlCvTypeSource();
  76. ~BlCvTypeSource();
  77. void CreateIPI();
  78. void Init(BlCodeView* codeView);
  79. };
  80. NS_BF_END