verify-di: Implement DebugInfoVerifier

Implement DebugInfoVerifier, which steals verification relying on
DebugInfoFinder from Verifier.

  - Adds LegacyDebugInfoVerifierPassPass, a ModulePass which wraps
    DebugInfoVerifier.  Uses -verify-di command-line flag.

  - Change verifyModule() to invoke DebugInfoVerifier as well as
    Verifier.

  - Add a call to createDebugInfoVerifierPass() wherever there was a
    call to createVerifierPass().

This implementation as a module pass should sidestep efficiency issues,
allowing us to turn debug info verification back on.

<rdar://problem/15500563>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206300 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2014-04-15 16:27:38 +00:00
parent abf483ba52
commit 32791b02fa
10 changed files with 137 additions and 53 deletions

View File

@@ -28,6 +28,7 @@ namespace llvm {
class Function;
class FunctionPass;
class ModulePass;
class Module;
class PreservedAnalyses;
class raw_ostream;
@@ -58,6 +59,18 @@ bool verifyModule(const Module &M, raw_ostream *OS = nullptr);
/// Note that this creates a pass suitable for the legacy pass manager. It has nothing to do with \c VerifierPass.
FunctionPass *createVerifierPass(bool FatalErrors = true);
/// \brief Create a debug-info verifier pass.
///
/// Check a module for validity of debug info. This is essentially a pass
/// wrapped around the debug-info parts of \a verifyModule(). When the pass
/// detects a verification error it is always printed to stderr, and by default
/// they are fatal. You can override that by passing \c false to \p
/// FatalErrors.
///
/// Note that this creates a pass suitable for the legacy pass manager. It has
/// nothing to do with \c VerifierPass.
ModulePass *createDebugInfoVerifierPass(bool FatalErrors = true);
class VerifierPass {
bool FatalErrors;

View File

@@ -103,6 +103,7 @@ void initializeDAHPass(PassRegistry&);
void initializeDCEPass(PassRegistry&);
void initializeDSEPass(PassRegistry&);
void initializeDebugIRPass(PassRegistry&);
void initializeDebugInfoVerifierLegacyPassPass(PassRegistry &);
void initializeDeadInstEliminationPass(PassRegistry&);
void initializeDeadMachineInstructionElimPass(PassRegistry&);
void initializeDelinearizationPass(PassRegistry &);