From a55c4b1ce71bf62b669d5e533544a29739d56a98 Mon Sep 17 00:00:00 2001
From: Chris Lattner <sabre@nondot.org>
Date: Thu, 28 Aug 2003 16:25:34 +0000
Subject: Reorder #includes Make sure that we veryify the result before writing
 it out!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8177 91177308-0d34-0410-b5e6-96231b3b80d8
---
 tools/llvm-link/llvm-link.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'tools/llvm-link')

diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp
index 58959cfa41..5c9e21c0b0 100644
--- a/tools/llvm-link/llvm-link.cpp
+++ b/tools/llvm-link/llvm-link.cpp
@@ -6,10 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Transforms/Utils/Linker.h"
+#include "llvm/Module.h"
+#include "llvm/Analysis/Verifier.h"
 #include "llvm/Bytecode/Reader.h"
 #include "llvm/Bytecode/Writer.h"
-#include "llvm/Module.h"
+#include "llvm/Transforms/Utils/Linker.h"
 #include "Support/CommandLine.h"
 #include "Support/Signals.h"
 #include <fstream>
@@ -125,6 +126,11 @@ int main(int argc, char **argv) {
     RemoveFileOnSignal(OutputFilename);
   }
 
+  if (verifyModule(*Composite.get())) {
+    std::cerr << argv[0] << ": linked module is broken!\n";
+    return 1;
+  }
+
   if (Verbose) std::cerr << "Writing bytecode...\n";
   WriteBytecodeToFile(Composite.get(), *Out);
 
-- 
cgit v1.2.3-18-g5258