Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Unified Diff: include/llvm/Analysis/NaCl.h

Issue 12449014: ABI verifier: Add standalone tool pnacl-abicheck (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: cleanup, use << for error streams uniformly Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698