aboutsummaryrefslogtreecommitdiffstats
path: root/lib/IR
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-10-16 01:49:05 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-10-16 01:49:05 +0000
commit3aa342be500a55c3bbee302f3a8db937eaa2c241 (patch)
tree67a3fdefd87ee3ae640e049750695e3cda468ca9 /lib/IR
parenta486f55569c584d00cfdde43a8755d68cdb68c4f (diff)
downloadexternal_llvm-3aa342be500a55c3bbee302f3a8db937eaa2c241.zip
external_llvm-3aa342be500a55c3bbee302f3a8db937eaa2c241.tar.gz
external_llvm-3aa342be500a55c3bbee302f3a8db937eaa2c241.tar.bz2
Add support for metadata representing .ident directives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192764 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r--lib/IR/Verifier.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp
index c7559c1..7d657de 100644
--- a/lib/IR/Verifier.cpp
+++ b/lib/IR/Verifier.cpp
@@ -216,6 +216,7 @@ namespace {
visitNamedMDNode(*I);
visitModuleFlags(M);
+ visitModuleIdents(M);
// Verify Debug Info.
verifyDebugInfo(M);
@@ -260,6 +261,7 @@ namespace {
void visitGlobalAlias(GlobalAlias &GA);
void visitNamedMDNode(NamedMDNode &NMD);
void visitMDNode(MDNode &MD, Function *F);
+ void visitModuleIdents(Module &M);
void visitModuleFlags(Module &M);
void visitModuleFlag(MDNode *Op, DenseMap<MDString*, MDNode*> &SeenIDs,
SmallVectorImpl<MDNode*> &Requirements);
@@ -613,6 +615,24 @@ void Verifier::visitMDNode(MDNode &MD, Function *F) {
}
}
+void Verifier::visitModuleIdents(Module &M) {
+ const NamedMDNode *Idents = M.getNamedMetadata("llvm.ident");
+ if (!Idents)
+ return;
+
+ // llvm.ident takes a list of metadata entry. Each entry has only one string.
+ // Scan each llvm.ident entry and make sure that this requirement is met.
+ for (unsigned i = 0, e = Idents->getNumOperands(); i != e; ++i) {
+ const MDNode *N = Idents->getOperand(i);
+ Assert1(N->getNumOperands() == 1,
+ "incorrect number of operands in llvm.ident metadata", N);
+ Assert1(isa<MDString>(N->getOperand(0)),
+ ("invalid value for llvm.ident metadata entry operand"
+ "(the operand should be a string)"),
+ N->getOperand(0));
+ }
+}
+
void Verifier::visitModuleFlags(Module &M) {
const NamedMDNode *Flags = M.getModuleFlagsMetadata();
if (!Flags) return;