Fixed DIBuilder to verify that same imported entity will not be added twice to the "imports" list of the DICompileUnit.
Differential Revision: http://reviews.llvm.org/D17884 llvm-svn: 263379
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#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;
|
||||
@@ -168,8 +169,12 @@ static DIImportedEntity *
|
||||
createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context,
|
||||
Metadata *NS, unsigned Line, StringRef Name,
|
||||
SmallVectorImpl<TrackingMDNodeRef> &AllImportedModules) {
|
||||
unsigned EntitiesCount = C.pImpl->DIImportedEntitys.size();
|
||||
auto *M = DIImportedEntity::get(C, Tag, Context, DINodeRef(NS), Line, Name);
|
||||
AllImportedModules.emplace_back(M);
|
||||
if (EntitiesCount < C.pImpl->DIImportedEntitys.size())
|
||||
// A new Imported Entity was just added to the context.
|
||||
// Add it to the Imported Modules list.
|
||||
AllImportedModules.emplace_back(M);
|
||||
return M;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user