Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.6 KiB

  1. //===-- llvm/Analysis/Verifier.h - LLVM IR Verifier -------------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file defines the function verifier interface, that can be used for some
  11. // sanity checking of input to the system, and for checking that transformations
  12. // haven't done something bad.
  13. //
  14. // Note that this does not provide full 'java style' security and verifications,
  15. // instead it just tries to ensure that code is well formed.
  16. //
  17. // To see what specifically is checked, look at the top of Verifier.cpp
  18. //
  19. //===----------------------------------------------------------------------===//
  20. #ifndef LLVM_ANALYSIS_VERIFIER_H
  21. #define LLVM_ANALYSIS_VERIFIER_H
  22. #include <string>
  23. namespace llvm {
  24. class FunctionPass;
  25. class Module;
  26. class Function;
  27. /// @brief An enumeration to specify the action to be taken if errors found.
  28. ///
  29. /// This enumeration is used in the functions below to indicate what should
  30. /// happen if the verifier finds errors. Each of the functions that uses
  31. /// this enumeration as an argument provides a default value for it. The
  32. /// actions are listed below.
  33. enum VerifierFailureAction {
  34. AbortProcessAction, ///< verifyModule will print to stderr and abort()
  35. PrintMessageAction, ///< verifyModule will print to stderr and return true
  36. ReturnStatusAction ///< verifyModule will just return true
  37. };
  38. /// @brief Create a verifier pass.
  39. ///
  40. /// Check a module or function for validity. When the pass is used, the
  41. /// action indicated by the \p action argument will be used if errors are
  42. /// found.
  43. FunctionPass *createVerifierPass(
  44. VerifierFailureAction action = AbortProcessAction ///< Action to take
  45. );
  46. /// @brief Check a module for errors.
  47. ///
  48. /// If there are no errors, the function returns false. If an error is found,
  49. /// the action taken depends on the \p action parameter.
  50. /// This should only be used for debugging, because it plays games with
  51. /// PassManagers and stuff.
  52. bool verifyModule(
  53. const Module &M, ///< The module to be verified
  54. VerifierFailureAction action = AbortProcessAction, ///< Action to take
  55. std::string *ErrorInfo = 0 ///< Information about failures.
  56. );
  57. // verifyFunction - Check a function for errors, useful for use when debugging a
  58. // pass.
  59. bool verifyFunction(
  60. const Function &F, ///< The function to be verified
  61. VerifierFailureAction action = AbortProcessAction ///< Action to take
  62. );
  63. } // End llvm namespace
  64. #endif