1 //===- Verifier.h - LLVM IR Verifier ----------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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.
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.
17 // To see what specifically is checked, look at the top of Verifier.cpp
19 //===----------------------------------------------------------------------===//
21 #ifndef LLVM_IR_VERIFIER_H
22 #define LLVM_IR_VERIFIER_H
33 /// \brief Check a function for errors, useful for use when debugging a
36 /// If there are no errors, the function returns false. If an error is found,
37 /// a message describing the error is written to OS (if non-null) and true is
39 bool verifyFunction(const Function &F, raw_ostream *OS = 0);
41 /// \brief Check a module for errors.
43 /// If there are no errors, the function returns false. If an error is found,
44 /// a message describing the error is written to OS (if non-null) and true is
46 bool verifyModule(const Module &M, raw_ostream *OS = 0);
48 /// \brief Create a verifier pass.
50 /// Check a module or function for validity. This is essentially a pass wrapped
51 /// around the above verifyFunction and verifyModule routines and
52 /// functionality. When the pass detects a verification error it is always
53 /// printed to stderr, and by default they are fatal. You can override that by
54 /// passing \c false to \p FatalErrors.
55 FunctionPass *createVerifierPass(bool FatalErrors = true);
57 } // End llvm namespace