Index: include/llvm/IR/DebugInfoMetadata.h =================================================================== --- include/llvm/IR/DebugInfoMetadata.h +++ include/llvm/IR/DebugInfoMetadata.h @@ -2173,6 +2173,8 @@ } public: + static size_t getSize(LLVMContext &Context); + DEFINE_MDNODE_GET(DIImportedEntity, (unsigned Tag, DIScope *Scope, DINodeRef Entity, unsigned Line, StringRef Name = ""), Index: lib/IR/DIBuilder.cpp =================================================================== --- lib/IR/DIBuilder.cpp +++ lib/IR/DIBuilder.cpp @@ -19,7 +19,6 @@ #include "llvm/IR/Module.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Dwarf.h" -#include "LLVMContextImpl.h" using namespace llvm; using namespace llvm::dwarf; @@ -169,9 +168,9 @@ createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context, Metadata *NS, unsigned Line, StringRef Name, SmallVectorImpl &AllImportedModules) { - unsigned EntitiesCount = C.pImpl->DIImportedEntitys.size(); + auto EntitiesCount = DIImportedEntity::getSize(C); auto *M = DIImportedEntity::get(C, Tag, Context, DINodeRef(NS), Line, Name); - if (EntitiesCount < C.pImpl->DIImportedEntitys.size()) + if (EntitiesCount < DIImportedEntity::getSize(C)) // A new Imported Entity was just added to the context. // Add it to the Imported Modules list. AllImportedModules.emplace_back(M); Index: lib/IR/DebugInfoMetadata.cpp =================================================================== --- lib/IR/DebugInfoMetadata.cpp +++ lib/IR/DebugInfoMetadata.cpp @@ -184,6 +184,8 @@ setHash(GenericDINodeInfo::KeyTy::calculateHash(this)); } +#define DEFINE_GETIMPL_SIZE(CLASS) \ + return Context.pImpl->CLASS##s.size(); #define UNWRAP_ARGS_IMPL(...) __VA_ARGS__ #define UNWRAP_ARGS(ARGS) UNWRAP_ARGS_IMPL ARGS #define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS) \ @@ -529,6 +531,10 @@ DEFINE_GETIMPL_STORE(DIObjCProperty, (Line, Attributes), Ops); } +size_t DIImportedEntity::getSize(LLVMContext &Context) { + DEFINE_GETIMPL_SIZE(DIImportedEntity); +} + DIImportedEntity *DIImportedEntity::getImpl(LLVMContext &Context, unsigned Tag, Metadata *Scope, Metadata *Entity, unsigned Line, MDString *Name,