| OLD | NEW |
| 1 //===-- NaCl.h - NaCl Analysis ---------------------------*- C++ -*-===// | 1 //===-- NaCl.h - NaCl Analysis ---------------------------*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 | 9 |
| 10 #ifndef LLVM_ANALYSIS_NACL_H | 10 #ifndef LLVM_ANALYSIS_NACL_H |
| 11 #define LLVM_ANALYSIS_NACL_H | 11 #define LLVM_ANALYSIS_NACL_H |
| 12 | 12 |
| 13 #include "llvm/Support/raw_ostream.h" |
| 14 #include <string> |
| 15 |
| 13 namespace llvm { | 16 namespace llvm { |
| 14 | 17 |
| 15 class FunctionPass; | 18 class FunctionPass; |
| 16 class ModulePass; | 19 class ModulePass; |
| 17 | 20 |
| 18 FunctionPass *createPNaClABIVerifyFunctionsPass(); | 21 class PNaClABIErrorReporter { |
| 19 ModulePass *createPNaClABIVerifyModulePass(); | 22 public: |
| 23 PNaClABIErrorReporter() : ErrorCount(0), Errors(ErrorString) {} |
| 24 // Return the number of verification errors from the last run. |
| 25 int getErrorCount() { return ErrorCount; } |
| 26 // Print the error messages to O |
| 27 void printErrors(llvm::raw_ostream &O) { |
| 28 Errors.flush(); |
| 29 O << ErrorString; |
| 30 } |
| 31 // Increments the error count and returns an ostream to which the error |
| 32 // message can be streamed. |
| 33 raw_ostream &addError() { |
| 34 ErrorCount++; |
| 35 return Errors; |
| 36 } |
| 37 // Reset the error count and error messages. |
| 38 void reset() { |
| 39 ErrorCount = 0; |
| 40 Errors.flush(); |
| 41 ErrorString.clear(); |
| 42 } |
| 43 private: |
| 44 int ErrorCount; |
| 45 std::string ErrorString; |
| 46 raw_string_ostream Errors; |
| 47 }; |
| 48 |
| 49 FunctionPass *createPNaClABIVerifyFunctionsPass(PNaClABIErrorReporter * Reporter
); |
| 50 ModulePass *createPNaClABIVerifyModulePass(PNaClABIErrorReporter * Reporter); |
| 20 | 51 |
| 21 } | 52 } |
| 22 | 53 |
| 23 | 54 |
| 24 #endif | 55 #endif |
| OLD | NEW |