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

Side by Side Diff: tools/pnacl-abicheck/pnacl-abicheck.cpp

Issue 1151093004: Changes from 3.7 merge to files not in upstream (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 //===-- pnacl-abicheck.cpp - Check PNaCl bitcode ABI ----------------===// 1 //===-- pnacl-abicheck.cpp - Check PNaCl bitcode ABI ----------------===//
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 // This tool checks files for compliance with the PNaCl bitcode ABI 10 // This tool checks files for compliance with the PNaCl bitcode ABI
11 // 11 //
12 //===----------------------------------------------------------------------===// 12 //===----------------------------------------------------------------------===//
13 13
14 #include "llvm/Analysis/NaCl.h" 14 #include "llvm/Analysis/NaCl.h"
15 #include "llvm/IR/DataLayout.h" 15 #include "llvm/IR/DataLayout.h"
16 #include "llvm/IR/LLVMContext.h" 16 #include "llvm/IR/LLVMContext.h"
17 #include "llvm/IR/Module.h" 17 #include "llvm/IR/Module.h"
18 #include "llvm/IRReader/IRReader.h" 18 #include "llvm/IRReader/IRReader.h"
19 #include "llvm/Pass.h" 19 #include "llvm/Pass.h"
20 #include "llvm/PassManager.h" 20 #include "llvm/IR/LegacyPassManager.h"
21 #include "llvm/Support/CommandLine.h" 21 #include "llvm/Support/CommandLine.h"
22 #include "llvm/Support/FormattedStream.h" 22 #include "llvm/Support/FormattedStream.h"
23 #include "llvm/Support/SourceMgr.h" 23 #include "llvm/Support/SourceMgr.h"
24 #include <string> 24 #include <string>
25 25
26 using namespace llvm; 26 using namespace llvm;
27 27
28 static cl::opt<std::string> 28 static cl::opt<std::string>
29 InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-")); 29 InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
30 30
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 PNaClABIErrorReporter ABIErrorReporter; 80 PNaClABIErrorReporter ABIErrorReporter;
81 ABIErrorReporter.setNonFatal(); 81 ABIErrorReporter.setNonFatal();
82 bool ErrorsFound = false; 82 bool ErrorsFound = false;
83 83
84 std::unique_ptr<ModulePass> ModuleChecker( 84 std::unique_ptr<ModulePass> ModuleChecker(
85 createPNaClABIVerifyModulePass(&ABIErrorReporter)); 85 createPNaClABIVerifyModulePass(&ABIErrorReporter));
86 ModuleChecker->doInitialization(*Mod); 86 ModuleChecker->doInitialization(*Mod);
87 ModuleChecker->runOnModule(*Mod); 87 ModuleChecker->runOnModule(*Mod);
88 ErrorsFound |= CheckABIVerifyErrors(ABIErrorReporter, "Module"); 88 ErrorsFound |= CheckABIVerifyErrors(ABIErrorReporter, "Module");
89 89
90 std::unique_ptr<FunctionPassManager> PM(new FunctionPassManager(&*Mod)); 90 std::unique_ptr<legacy::FunctionPassManager> PM(
91 PM->add(new DataLayoutPass()); 91 new legacy::FunctionPassManager(&*Mod));
92 PM->add(createPNaClABIVerifyFunctionsPass(&ABIErrorReporter)); 92 PM->add(createPNaClABIVerifyFunctionsPass(&ABIErrorReporter));
93 93
94 PM->doInitialization(); 94 PM->doInitialization();
95 for (Module::iterator I = Mod->begin(), E = Mod->end(); I != E; ++I) { 95 for (Module::iterator I = Mod->begin(), E = Mod->end(); I != E; ++I) {
96 PM->run(*I); 96 PM->run(*I);
97 ErrorsFound |= 97 ErrorsFound |=
98 CheckABIVerifyErrors(ABIErrorReporter, "Function " + I->getName()); 98 CheckABIVerifyErrors(ABIErrorReporter, "Function " + I->getName());
99 } 99 }
100 PM->doFinalization(); 100 PM->doFinalization();
101 101
102 return ErrorsFound ? 1 : 0; 102 return ErrorsFound ? 1 : 0;
103 } 103 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698