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 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 22 #include "llvm/IR/PassManager.h" 23 24 namespace llvm { 25 26 class FunctionPass; 27 class Module; 28 class Function; 29 30 FunctionPass *createLintLegacyPassPass(); 31 32 /// Lint a module. 33 /// 34 /// This should only be used for debugging, because it plays games with 35 /// PassManagers and stuff. 36 void lintModule(const Module &M); 37 38 // Lint a function. 39 void lintFunction(const Function &F); 40 41 class LintPass : public PassInfoMixin<LintPass> { 42 public: 43 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 44 }; 45 46 } // namespace llvm 47 48 #endif // LLVM_ANALYSIS_LINT_H 49