Lint.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- llvm/Analysis/Lint.h - LLVM IR Lint ---------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file defines lint interfaces that can be used for some validation of
  15. // input to the system, and for checking that transformations haven't done
  16. // something bad. In contrast to the Verifier, the Lint checker checks for
  17. // undefined behavior or constructions with likely unintended behavior.
  18. //
  19. // To see what specifically is checked, look at Lint.cpp
  20. //
  21. //===----------------------------------------------------------------------===//
  22. #ifndef LLVM_ANALYSIS_LINT_H
  23. #define LLVM_ANALYSIS_LINT_H
  24. #include "llvm/IR/PassManager.h"
  25. namespace llvm {
  26. class FunctionPass;
  27. class Module;
  28. class Function;
  29. FunctionPass *createLintLegacyPassPass();
  30. /// Lint a module.
  31. ///
  32. /// This should only be used for debugging, because it plays games with
  33. /// PassManagers and stuff.
  34. void lintModule(const Module &M);
  35. // Lint a function.
  36. void lintFunction(const Function &F);
  37. class LintPass : public PassInfoMixin<LintPass> {
  38. public:
  39. PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
  40. };
  41. } // namespace llvm
  42. #endif // LLVM_ANALYSIS_LINT_H
  43. #ifdef __GNUC__
  44. #pragma GCC diagnostic pop
  45. #endif