aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Analysis
diff options
context:
space:
mode:
authorEli Bendersky <eliben@chromium.org>2013-03-20 15:05:17 -0700
committerEli Bendersky <eliben@chromium.org>2013-03-20 15:05:17 -0700
commitac16fba57480ab5529dab0c63f33e65b0003e205 (patch)
tree7c68e40df882d67ba2f6f533a9638c382319221c /include/llvm/Analysis
parentd41567d2ffd3413600162653c08b2365bd5bcbbf (diff)
parent3503cf8d938c71581c0439dd1267e171f0ef74b1 (diff)
Merge remote-tracking branch 'origin/master'
Merge Nacl-LLVM work since the upstream merge branched
Diffstat (limited to 'include/llvm/Analysis')
-rw-r--r--include/llvm/Analysis/NaCl.h35
1 files changed, 33 insertions, 2 deletions
diff --git a/include/llvm/Analysis/NaCl.h b/include/llvm/Analysis/NaCl.h
index 8e599594b2..a8f2c9651e 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);
}