diff options
| author | Adrian Prantl <aprantl@apple.com> | 2016-10-05 22:15:37 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2016-10-05 22:15:37 +0000 |
| commit | b3510afcd1eb1c03bb4b30b3a53cc5c6a9997227 (patch) | |
| tree | f8463686d7ee15529ed72f9f9e2a519b2f2b6a26 /llvm/lib/IR | |
| parent | 497f0854755311e666c750de772de31e6fab10f9 (diff) | |
| download | bcm5719-llvm-b3510afcd1eb1c03bb4b30b3a53cc5c6a9997227.tar.gz bcm5719-llvm-b3510afcd1eb1c03bb4b30b3a53cc5c6a9997227.zip | |
Verifier: Reject any unknown named MD nodes in the llvm.dbg namespace.
This came out of a discussion in https://reviews.llvm.org/D25285.
There used to be various other llvm.dbg.* nodes, but we don't support
upgrading them and we want to reserve the namespace for future uses.
This also removes an entirely obsolete and bitrotted testcase for PR7662.
Reapplies 283390 with a forgotten testcase.
llvm-svn: 283400
Diffstat (limited to 'llvm/lib/IR')
| -rw-r--r-- | llvm/lib/IR/Verifier.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 980cb7746ec..7eea5170b94 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -698,10 +698,15 @@ void Verifier::visitGlobalAlias(const GlobalAlias &GA) { } void Verifier::visitNamedMDNode(const NamedMDNode &NMD) { + // There used to be various other llvm.dbg.* nodes, but we don't support + // upgrading them and we want to reserve the namespace for future uses. + if (NMD.getName().startswith("llvm.dbg.")) + AssertDI(NMD.getName() == "llvm.dbg.cu", + "unrecognized named metadata node in the llvm.dbg namespace", + &NMD); for (const MDNode *MD : NMD.operands()) { - if (NMD.getName() == "llvm.dbg.cu") { + if (NMD.getName() == "llvm.dbg.cu") AssertDI(MD && isa<DICompileUnit>(MD), "invalid compile unit", &NMD, MD); - } if (!MD) continue; |

