Lint.h 1.4 KB

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