OLD | NEW |
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 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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<FunctionPassManager> PM(new FunctionPassManager(&*Mod)); |
91 PM->add(new DataLayoutPass(&*Mod)); | 91 PM->add(new DataLayoutPass()); |
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 } |
OLD | NEW |