LLVM 22.0.0git
Lint.h
Go to the documentation of this file.
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
23namespace llvm {
24
25class Module;
26class Function;
27
28/// Lint a module.
29///
30/// This should only be used for debugging, because it plays games with
31/// PassManagers and stuff.
32void lintModule(const Module &M, bool AbortOnError = false);
33
34// Lint a function.
35void lintFunction(const Function &F, bool AbortOnError = false);
36
37class LintPass : public PassInfoMixin<LintPass> {
38 const bool AbortOnError;
39
40public:
41 LintPass(bool AbortOnError) : AbortOnError(AbortOnError) {}
43
45 function_ref<StringRef(StringRef)> MapClassName2PassName);
46};
47
48} // namespace llvm
49
50#endif // LLVM_ANALYSIS_LINT_H
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition MD5.cpp:55
LintPass(bool AbortOnError)
Definition Lint.h:41
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Definition Lint.cpp:721
void printPipeline(raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
Definition Lint.cpp:737
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
void lintModule(const Module &M, bool AbortOnError=false)
Lint a module.
Definition Lint.cpp:770
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
void lintFunction(const Function &F, bool AbortOnError=false)
lintFunction - Check a function for errors, printing messages on stderr.
Definition Lint.cpp:750
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition PassManager.h:70