blob: 6eb637e727821d6cd2bfbd9f48e59104e1e2f7c6 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===-- llvm/Analysis/Lint.h - LLVM IR Lint ---------------------*- C++ -*-===//
2//
Andrew Walbran16937d02019-10-22 13:54:20 +01003// 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 Scull5e1ddfa2018-08-14 10:06:54 +01006//
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 Deprezf4ef2d02021-04-20 13:36:24 +020022#include "llvm/IR/PassManager.h"
23
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010024namespace llvm {
25
26class FunctionPass;
27class Module;
28class Function;
29
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020030FunctionPass *createLintLegacyPassPass();
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010031
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020032/// Lint a module.
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010033///
34/// This should only be used for debugging, because it plays games with
35/// PassManagers and stuff.
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020036void lintModule(const Module &M);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010037
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020038// Lint a function.
39void lintFunction(const Function &F);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010040
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020041class LintPass : public PassInfoMixin<LintPass> {
42public:
43 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
44};
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010045
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020046} // namespace llvm
47
48#endif // LLVM_ANALYSIS_LINT_H