Index: include/llvm/Analysis/NaCl.h |
diff --git a/include/llvm/Analysis/NaCl.h b/include/llvm/Analysis/NaCl.h |
index 8e599594b2716ca2747f0db0c48ca3f86dd821dd..a8f2c9651e835ac672cbefb6b51beb95a6249209 100644 |
--- a/include/llvm/Analysis/NaCl.h |
+++ b/include/llvm/Analysis/NaCl.h |
@@ -10,13 +10,44 @@ |
#ifndef LLVM_ANALYSIS_NACL_H |
#define LLVM_ANALYSIS_NACL_H |
+#include "llvm/Support/raw_ostream.h" |
+#include <string> |
+ |
namespace llvm { |
class FunctionPass; |
class ModulePass; |
-FunctionPass *createPNaClABIVerifyFunctionsPass(); |
-ModulePass *createPNaClABIVerifyModulePass(); |
+class PNaClABIErrorReporter { |
+ public: |
+ PNaClABIErrorReporter() : ErrorCount(0), Errors(ErrorString) {} |
+ // Return the number of verification errors from the last run. |
+ int getErrorCount() { return ErrorCount; } |
+ // Print the error messages to O |
+ void printErrors(llvm::raw_ostream &O) { |
+ Errors.flush(); |
+ O << ErrorString; |
+ } |
+ // Increments the error count and returns an ostream to which the error |
+ // message can be streamed. |
+ raw_ostream &addError() { |
+ ErrorCount++; |
+ return Errors; |
+ } |
+ // Reset the error count and error messages. |
+ void reset() { |
+ ErrorCount = 0; |
+ Errors.flush(); |
+ ErrorString.clear(); |
+ } |
+ private: |
+ int ErrorCount; |
+ std::string ErrorString; |
+ raw_string_ostream Errors; |
+}; |
+ |
+FunctionPass *createPNaClABIVerifyFunctionsPass(PNaClABIErrorReporter * Reporter); |
+ModulePass *createPNaClABIVerifyModulePass(PNaClABIErrorReporter * Reporter); |
} |