[llvm] r233094 - Verifier: !llvm.dbg.cu must point at compile units

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Mar 24 10:18:03 PDT 2015


Author: dexonsmith
Date: Tue Mar 24 12:18:03 2015
New Revision: 233094

URL: http://llvm.org/viewvc/llvm-project?rev=233094&view=rev
Log:
Verifier: !llvm.dbg.cu must point at compile units

Duplicate this check from `verifyDebugInfo()`.

Modified:
    llvm/trunk/lib/IR/Verifier.cpp

Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=233094&r1=233093&r2=233094&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Tue Mar 24 12:18:03 2015
@@ -111,6 +111,13 @@ private:
     OS << '\n';
   }
 
+  void Write(const NamedMDNode *NMD) {
+    if (!NMD)
+      return;
+    NMD->print(OS);
+    OS << '\n';
+  }
+
   void Write(Type *T) {
     if (!T)
       return;
@@ -562,6 +569,10 @@ void Verifier::visitNamedMDNode(const Na
     if (!MD)
       continue;
 
+    if (NMD.getName() == "llvm.dbg.cu") {
+      Assert(isa<MDCompileUnit>(MD), "invalid compile unit", &NMD, MD);
+    }
+
     visitMDNode(*MD);
   }
 }





More information about the llvm-commits mailing list