1 //===-- llvm/Analysis/Lint.h - LLVM IR Lint ---------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines lint interfaces that can be used for some validation of
10 // input to the system, and for checking that transformations haven't done
11 // something bad. In contrast to the Verifier, the Lint checker checks for
12 // undefined behavior or constructions with likely unintended behavior.
13 //
14 // To see what specifically is checked, look at Lint.cpp
15 //
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef LLVM_ANALYSIS_LINT_H
19 #define LLVM_ANALYSIS_LINT_H
20 
21 #include "llvm/IR/PassManager.h"
22 
23 namespace llvm {
24 
25 class FunctionPass;
26 class Module;
27 class Function;
28 
29 FunctionPass *createLintLegacyPassPass();
30 
31 /// Lint a module.
32 ///
33 /// This should only be used for debugging, because it plays games with
34 /// PassManagers and stuff.
35 void lintModule(const Module &M);
36 
37 // Lint a function.
38 void lintFunction(const Function &F);
39 
40 class LintPass : public PassInfoMixin<LintPass> {
41 public:
42   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
43 };
44 
45 } // namespace llvm
46 
47 #endif // LLVM_ANALYSIS_LINT_H
48