summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-17 00:16:35 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-17 00:16:35 +0000
commit79f8d11d5af9d75154177352dbb03993246bf191 (patch)
tree08923f5464bc40d4061594e7cbe69a084738ca88 /llvm/lib
parentde0a0f310080a5d36c3692136e51ed18f8456df2 (diff)
downloadbcm5719-llvm-79f8d11d5af9d75154177352dbb03993246bf191.tar.gz
bcm5719-llvm-79f8d11d5af9d75154177352dbb03993246bf191.zip
AsmWriter: Assert on unresolved metadata nodes
Assert that `MDNode::isResolved()`. While in theory the `Verifier` should catch this, it doesn't descend into all debug info, and the `DebugInfoVerifier` doesn't call into the `Verifier`. Besides, this helps to catch bugs when `-disable-verify=true`. Note that I haven't come across a place where this fails with clang today, so no testcase. llvm-svn: 232442
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index d2417acc689..0123fb263fc 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1205,6 +1205,8 @@ static void WriteModuleMetadata(const Module *M,
SmallVector<uint64_t, 64> Record;
for (const Metadata *MD : MDs) {
if (const MDNode *N = dyn_cast<MDNode>(MD)) {
+ assert(N->isResolved() && "Expected forward references to be resolved");
+
switch (N->getMetadataID()) {
default:
llvm_unreachable("Invalid MDNode subclass");
OpenPOWER on IntegriCloud