[cfi-verify] Added a simple check that stops division-by-zero error when no indirect...
authorMitch Phillips <mitchphillips@outlook.com>
Mon, 6 Nov 2017 19:14:09 +0000 (19:14 +0000)
committerMitch Phillips <mitchphillips@outlook.com>
Mon, 6 Nov 2017 19:14:09 +0000 (19:14 +0000)
llvm-svn: 317500

llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp

index a3c202f..3b4a5c1 100644 (file)
@@ -132,8 +132,10 @@ void printIndirectCFInstructions(FileAnalysis &Analysis,
   uint64_t IndirectCFInstructions = ExpectedProtected + UnexpectedProtected +
                                     ExpectedUnprotected + UnexpectedUnprotected;
 
-  if (IndirectCFInstructions == 0)
+  if (IndirectCFInstructions == 0) {
     outs() << "No indirect CF instructions found.\n";
+    return;
+  }
 
   outs() << formatv("Expected Protected: {0} ({1:P})\n"
                     "Unexpected Protected: {2} ({3:P})\n"