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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 //===-- NaCl.h - NaCl Analysis ---------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_ANALYSIS_NACL_H
11 #define LLVM_ANALYSIS_NACL_H
12
13 #include "llvm/Support/CommandLine.h"
14 #include "llvm/Support/ErrorHandling.h"
15 #include "llvm/Support/raw_ostream.h"
16 #include <string>
17
18 namespace llvm {
19
20 class FunctionPass;
21 class ModulePass;
22 extern cl::opt<bool> PNaClABIAllowDebugMetadata;
23
24 class PNaClABIErrorReporter {
25 PNaClABIErrorReporter(const PNaClABIErrorReporter&) LLVM_DELETED_FUNCTION;
26 void operator=(const PNaClABIErrorReporter&) LLVM_DELETED_FUNCTION;
27 public:
28 PNaClABIErrorReporter() : ErrorCount(0), Errors(ErrorString),
29 UseFatalErrors(true) {}
30 ~PNaClABIErrorReporter() {}
31 // Return the number of verification errors from the last run.
32 int getErrorCount() const { return ErrorCount; }
33 // Print the error messages to O
34 void printErrors(llvm::raw_ostream &O) {
35 Errors.flush();
36 O << ErrorString;
37 }
38 // Increments the error count and returns an ostream to which the error
39 // message can be streamed.
40 raw_ostream &addError() {
41 ErrorCount++;
42 return Errors;
43 }
44 // Reset the error count and error messages.
45 void reset() {
46 ErrorCount = 0;
47 Errors.flush();
48 ErrorString.clear();
49 }
50 void setNonFatal() {
51 UseFatalErrors = false;
52 }
53 void checkForFatalErrors() {
54 if (UseFatalErrors && ErrorCount != 0) {
55 printErrors(errs());
56 report_fatal_error("PNaCl ABI verification failed");
57 }
58 }
59 private:
60 int ErrorCount;
61 std::string ErrorString;
62 raw_string_ostream Errors;
63 bool UseFatalErrors;
64 };
65
66 FunctionPass *createPNaClABIVerifyFunctionsPass(
67 PNaClABIErrorReporter *Reporter);
68 ModulePass *createPNaClABIVerifyModulePass(PNaClABIErrorReporter *Reporter,
69 bool StreamingMode = false);
70
71 }
72
73
74 #endif
OLDNEW
« 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