summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/DIBuilder.cpp49
-rw-r--r--llvm/lib/IR/DebugInfo.cpp3
2 files changed, 41 insertions, 11 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 4bb87c9afb7..1c799452754 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -128,21 +128,50 @@ void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
NMD->addOperand(TheCU);
}
-DIImportedEntity DIBuilder::createImportedModule(DIScope Context,
- DINameSpace NS,
- unsigned Line) {
- Value *Elts[] = {
- GetTagConstant(VMContext, dwarf::DW_TAG_imported_module),
- Context,
- NS,
- ConstantInt::get(Type::getInt32Ty(VMContext), Line),
- };
- DIImportedEntity M(MDNode::get(VMContext, Elts));
+static DIImportedEntity
+createImportedModule(LLVMContext &C, DIScope Context, DIDescriptor NS,
+ unsigned Line, StringRef Name,
+ SmallVectorImpl<Value *> &AllImportedModules) {
+ const MDNode *R;
+ if (Name.empty()) {
+ Value *Elts[] = {
+ GetTagConstant(C, dwarf::DW_TAG_imported_module),
+ Context,
+ NS,
+ ConstantInt::get(Type::getInt32Ty(C), Line),
+ };
+ R = MDNode::get(C, Elts);
+ } else {
+ Value *Elts[] = {
+ GetTagConstant(C, dwarf::DW_TAG_imported_module),
+ Context,
+ NS,
+ ConstantInt::get(Type::getInt32Ty(C), Line),
+ MDString::get(C, Name)
+ };
+ R = MDNode::get(C, Elts);
+ }
+ DIImportedEntity M(R);
assert(M.Verify() && "Imported module should be valid");
AllImportedModules.push_back(M);
return M;
}
+DIImportedEntity DIBuilder::createImportedModule(DIScope Context,
+ DINameSpace NS, unsigned Line,
+ StringRef Name) {
+ return ::createImportedModule(VMContext, Context, NS, Line, Name,
+ AllImportedModules);
+}
+
+DIImportedEntity DIBuilder::createImportedModule(DIScope Context,
+ DIImportedEntity NS,
+ unsigned Line,
+ StringRef Name) {
+ return ::createImportedModule(VMContext, Context, NS, Line, Name,
+ AllImportedModules);
+}
+
DIImportedEntity DIBuilder::createImportedDeclaration(DIScope Context,
DIDescriptor Decl,
unsigned Line) {
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 8a0fb8d5b10..6a014aee5f3 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -591,7 +591,8 @@ bool DITemplateValueParameter::Verify() const {
/// \brief Verify that the imported module descriptor is well formed.
bool DIImportedEntity::Verify() const {
- return isImportedEntity() && DbgNode->getNumOperands() == 4;
+ return isImportedEntity() &&
+ (DbgNode->getNumOperands() == 4 || DbgNode->getNumOperands() == 5);
}
/// getOriginalTypeSize - If this type is derived from a base type then
OpenPOWER on IntegriCloud