DIArray GVs = getOrCreateArray(AllGVs);
DIType(TempGVs).replaceAllUsesWith(GVs);
- DIArray IMs = getOrCreateArray(AllImportedModules);
+ SmallVector<Value *, 16> RetainValuesI;
+ for (unsigned I = 0, E = AllImportedModules.size(); I < E; I++)
+ RetainValuesI.push_back(AllImportedModules[I]);
+ DIArray IMs = getOrCreateArray(RetainValuesI);
DIType(TempImportedModules).replaceAllUsesWith(IMs);
}
StringRef Directory,
StringRef Producer, bool isOptimized,
StringRef Flags, unsigned RunTimeVer,
- StringRef SplitName) {
+ StringRef SplitName,
+ DebugEmissionKind Kind) {
+
assert(((Lang <= dwarf::DW_LANG_Python && Lang >= dwarf::DW_LANG_C89) ||
(Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
"Invalid Language tag");
TempSubprograms,
TempGVs,
TempImportedModules,
- MDString::get(VMContext, SplitName)
+ MDString::get(VMContext, SplitName),
+ ConstantInt::get(Type::getInt32Ty(VMContext), Kind)
};
MDNode *CUNode = MDNode::get(VMContext, Elts);
static DIImportedEntity
createImportedModule(LLVMContext &C, DIScope Context, DIDescriptor NS,
unsigned Line, StringRef Name,
- SmallVectorImpl<Value *> &AllImportedModules) {
+ SmallVectorImpl<TrackingVH<MDNode>> &AllImportedModules) {
const MDNode *R;
if (Name.empty()) {
Value *Elts[] = {
}
DIImportedEntity M(R);
assert(M.Verify() && "Imported module should be valid");
- AllImportedModules.push_back(M);
+ AllImportedModules.push_back(TrackingVH<MDNode>(M));
return M;
}
};
DIImportedEntity M(MDNode::get(VMContext, Elts));
assert(M.Verify() && "Imported module should be valid");
- AllImportedModules.push_back(M);
+ AllImportedModules.push_back(TrackingVH<MDNode>(M));
return M;
}
/// getOrCreateArray - Get a DIArray, create one if required.
DIArray DIBuilder::getOrCreateArray(ArrayRef<Value *> Elements) {
- if (Elements.empty()) {
- Value *Null = Constant::getNullValue(Type::getInt32Ty(VMContext));
- return DIArray(MDNode::get(VMContext, Null));
- }
return DIArray(MDNode::get(VMContext, Elements));
}