Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===-- llvm/Analysis/Lint.h - LLVM IR Lint ---------------------*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file defines lint interfaces that can be used for some sanity checking |
| 10 | // of input to the system, and for checking that transformations |
| 11 | // haven't done something bad. In contrast to the Verifier, the Lint checker |
| 12 | // checks for undefined behavior or constructions with likely unintended |
| 13 | // behavior. |
| 14 | // |
| 15 | // To see what specifically is checked, look at Lint.cpp |
| 16 | // |
| 17 | //===----------------------------------------------------------------------===// |
| 18 | |
| 19 | #ifndef LLVM_ANALYSIS_LINT_H |
| 20 | #define LLVM_ANALYSIS_LINT_H |
| 21 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 22 | #include "llvm/IR/PassManager.h" |
| 23 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 24 | namespace llvm { |
| 25 | |
| 26 | class FunctionPass; |
| 27 | class Module; |
| 28 | class Function; |
| 29 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 30 | FunctionPass *createLintLegacyPassPass(); |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 31 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 32 | /// Lint a module. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 33 | /// |
| 34 | /// This should only be used for debugging, because it plays games with |
| 35 | /// PassManagers and stuff. |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 36 | void lintModule(const Module &M); |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 37 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 38 | // Lint a function. |
| 39 | void lintFunction(const Function &F); |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 40 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 41 | class LintPass : public PassInfoMixin<LintPass> { |
| 42 | public: |
| 43 | PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); |
| 44 | }; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 45 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 46 | } // namespace llvm |
| 47 | |
| 48 | #endif // LLVM_ANALYSIS_LINT_H |