Lint.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 sanity checking
  15. // of input to the system, and for checking that transformations
  16. // haven't done something bad. In contrast to the Verifier, the Lint checker
  17. // checks for undefined behavior or constructions with likely unintended
  18. // behavior.
  19. //
  20. // To see what specifically is checked, look at Lint.cpp
  21. //
  22. //===----------------------------------------------------------------------===//
  23. #ifndef LLVM_ANALYSIS_LINT_H
  24. #define LLVM_ANALYSIS_LINT_H
  25. #include "llvm/IR/PassManager.h"
  26. namespace llvm {
  27. class FunctionPass;
  28. class Module;
  29. class Function;
  30. FunctionPass *createLintLegacyPassPass();
  31. /// Lint a module.
  32. ///
  33. /// This should only be used for debugging, because it plays games with
  34. /// PassManagers and stuff.
  35. void lintModule(const Module &M);
  36. // Lint a function.
  37. void lintFunction(const Function &F);
  38. class LintPass : public PassInfoMixin<LintPass> {
  39. public:
  40. PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
  41. };
  42. } // namespace llvm
  43. #endif // LLVM_ANALYSIS_LINT_H
  44. #ifdef __GNUC__
  45. #pragma GCC diagnostic pop
  46. #endif