Add a lint check for indirectbr with no successors.
[oota-llvm.git] / lib / Analysis / Lint.cpp
index 949bbbd8b6c2765b8b20f1b9c136ce31faf47e19..5624430332a37f972b89e316931b920cc88ddeef 100644 (file)
@@ -519,6 +519,9 @@ void Lint::visitVAArgInst(VAArgInst &I) {
 
 void Lint::visitIndirectBrInst(IndirectBrInst &I) {
   visitMemoryReference(I, I.getAddress(), ~0u, 0, 0, MemRef::Branchee);
+
+  Assert1(I.getNumDestinations() != 0,
+          "Undefined behavior: indirectbr with no destinations", &I);
 }
 
 void Lint::visitExtractElementInst(ExtractElementInst &I) {