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

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

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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 | « include/llvm/ADT/Triple.h ('k') | include/llvm/Analysis/NaCl/PNaClABIProps.h » ('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
new file mode 100644
index 0000000000000000000000000000000000000000..035b5e7b811f8ada2d9ff314eea4fccfe4c4257d
--- /dev/null
+++ b/include/llvm/Analysis/NaCl.h
@@ -0,0 +1,74 @@
+//===-- NaCl.h - NaCl Analysis ---------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_ANALYSIS_NACL_H
+#define LLVM_ANALYSIS_NACL_H
+
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
+#include <string>
+
+namespace llvm {
+
+class FunctionPass;
+class ModulePass;
+extern cl::opt<bool> PNaClABIAllowDebugMetadata;
+
+class PNaClABIErrorReporter {
+ PNaClABIErrorReporter(const PNaClABIErrorReporter&) LLVM_DELETED_FUNCTION;
+ void operator=(const PNaClABIErrorReporter&) LLVM_DELETED_FUNCTION;
+ public:
+ PNaClABIErrorReporter() : ErrorCount(0), Errors(ErrorString),
+ UseFatalErrors(true) {}
+ ~PNaClABIErrorReporter() {}
+ // Return the number of verification errors from the last run.
+ int getErrorCount() const { 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();
+ }
+ void setNonFatal() {
+ UseFatalErrors = false;
+ }
+ void checkForFatalErrors() {
+ if (UseFatalErrors && ErrorCount != 0) {
+ printErrors(errs());
+ report_fatal_error("PNaCl ABI verification failed");
+ }
+ }
+ private:
+ int ErrorCount;
+ std::string ErrorString;
+ raw_string_ostream Errors;
+ bool UseFatalErrors;
+};
+
+FunctionPass *createPNaClABIVerifyFunctionsPass(
+ PNaClABIErrorReporter *Reporter);
+ModulePass *createPNaClABIVerifyModulePass(PNaClABIErrorReporter *Reporter,
+ bool StreamingMode = false);
+
+}
+
+
+#endif
« no previous file with comments | « include/llvm/ADT/Triple.h ('k') | include/llvm/Analysis/NaCl/PNaClABIProps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698