aboutsummaryrefslogtreecommitdiffstats
path: root/lib/IR
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-05-07 21:35:53 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-05-07 21:35:53 +0000
commit20d9e41ddb3f531267680819b5cac4cac1c6b231 (patch)
tree876162a4fa808369b673daf5be737c98476679bd /lib/IR
parent8cb6b971601d42a27e40f0f1d4828671441989f5 (diff)
downloadexternal_llvm-20d9e41ddb3f531267680819b5cac4cac1c6b231.zip
external_llvm-20d9e41ddb3f531267680819b5cac4cac1c6b231.tar.gz
external_llvm-20d9e41ddb3f531267680819b5cac4cac1c6b231.tar.bz2
Rename DIImportedModule to DIImportedEntity and allow imported declarations
DIBuilder::createImportedDeclaration isn't fully plumbed through (note, lacking in AsmPrinter/DwarfDebug support) but this seemed like a sufficiently useful division of code to make the subsequent patch(es) easier to follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181364 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r--lib/IR/DIBuilder.cpp19
-rw-r--r--lib/IR/DebugInfo.cpp16
2 files changed, 26 insertions, 9 deletions
diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp
index 0980e80..eb220b2 100644
--- a/lib/IR/DIBuilder.cpp
+++ b/lib/IR/DIBuilder.cpp
@@ -128,7 +128,7 @@ void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
NMD->addOperand(TheCU);
}
-DIImportedModule DIBuilder::createImportedModule(DIScope Context,
+DIImportedEntity DIBuilder::createImportedModule(DIScope Context,
DINameSpace NS,
unsigned Line) {
Value *Elts[] = {
@@ -137,7 +137,22 @@ DIImportedModule DIBuilder::createImportedModule(DIScope Context,
NS,
ConstantInt::get(Type::getInt32Ty(VMContext), Line),
};
- DIImportedModule M(MDNode::get(VMContext, Elts));
+ DIImportedEntity M(MDNode::get(VMContext, Elts));
+ assert(M.Verify() && "Imported module should be valid");
+ AllImportedModules.push_back(M);
+ return M;
+}
+
+DIImportedEntity DIBuilder::createImportedDeclaration(DIScope Context,
+ DIDescriptor Decl,
+ unsigned Line) {
+ Value *Elts[] = {
+ GetTagConstant(VMContext, dwarf::DW_TAG_imported_declaration),
+ Context,
+ Decl,
+ ConstantInt::get(Type::getInt32Ty(VMContext), Line),
+ };
+ DIImportedEntity M(MDNode::get(VMContext, Elts));
assert(M.Verify() && "Imported module should be valid");
AllImportedModules.push_back(M);
return M;
diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp
index ec83dca..3be5e0f 100644
--- a/lib/IR/DebugInfo.cpp
+++ b/lib/IR/DebugInfo.cpp
@@ -65,7 +65,7 @@ bool DIDescriptor::Verify() const {
DIObjCProperty(DbgNode).Verify() ||
DITemplateTypeParameter(DbgNode).Verify() ||
DITemplateValueParameter(DbgNode).Verify() ||
- DIImportedModule(DbgNode).Verify());
+ DIImportedEntity(DbgNode).Verify());
}
static Value *getField(const MDNode *DbgNode, unsigned Elt) {
@@ -338,9 +338,11 @@ bool DIDescriptor::isObjCProperty() const {
return DbgNode && getTag() == dwarf::DW_TAG_APPLE_property;
}
-/// \brief Return true if the specified tag is DW_TAG_imported_module.
-bool DIDescriptor::isImportedModule() const {
- return DbgNode && getTag() == dwarf::DW_TAG_imported_module;
+/// \brief Return true if the specified tag is DW_TAG_imported_module or
+/// DW_TAG_imported_declaration.
+bool DIDescriptor::isImportedEntity() const {
+ return DbgNode && (getTag() == dwarf::DW_TAG_imported_module ||
+ getTag() == dwarf::DW_TAG_imported_declaration);
}
//===----------------------------------------------------------------------===//
@@ -588,8 +590,8 @@ bool DITemplateValueParameter::Verify() const {
}
/// \brief Verify that the imported module descriptor is well formed.
-bool DIImportedModule::Verify() const {
- return isImportedModule() && DbgNode->getNumOperands() == 4;
+bool DIImportedEntity::Verify() const {
+ return isImportedEntity() && DbgNode->getNumOperands() == 4;
}
/// getOriginalTypeSize - If this type is derived from a base type then
@@ -742,7 +744,7 @@ DIArray DICompileUnit::getGlobalVariables() const {
return DIArray();
}
-DIArray DICompileUnit::getImportedModules() const {
+DIArray DICompileUnit::getImportedEntities() const {
if (!DbgNode || DbgNode->getNumOperands() < 13)
return DIArray();