From 0ec29cbb9c94236e6376445c5241722dc72b5cbc Mon Sep 17 00:00:00 2001 From: Mitch Phillips Date: Mon, 6 Nov 2017 19:14:09 +0000 Subject: [PATCH] [cfi-verify] Added a simple check that stops division-by-zero error when no indirect CF instructions are found in the provided file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317500 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-cfi-verify/llvm-cfi-verify.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/llvm-cfi-verify/llvm-cfi-verify.cpp b/tools/llvm-cfi-verify/llvm-cfi-verify.cpp index a3c202f53bb..3b4a5c155d0 100644 --- a/tools/llvm-cfi-verify/llvm-cfi-verify.cpp +++ b/tools/llvm-cfi-verify/llvm-cfi-verify.cpp @@ -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" -- 2.40.0