From: Chris Lattner Date: Wed, 30 Apr 2008 16:05:42 +0000 (+0000) Subject: Verify the whole module after codegen to catch silly IR bugs. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a1945fa74d04098d7e22d7c31585342555eca928;p=clang Verify the whole module after codegen to catch silly IR bugs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50485 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 7e5e8f06b7..bf1f0d823d 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -24,6 +24,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/Module.h" #include "llvm/Intrinsics.h" +#include "llvm/Analysis/Verifier.h" #include using namespace clang; using namespace CodeGen; @@ -48,6 +49,9 @@ CodeGenModule::~CodeGenModule() { EmitGlobalCtors(); EmitAnnotations(); delete Runtime; + + // Run the verifier to check that the generated code is consistent. + assert(!verifyModule(TheModule)); } /// WarnUnsupported - Print out a warning that codegen doesn't support the