[asan] remove .preinit_array from the compiler module (it breaks .so builds). This...
[oota-llvm.git] / lib / Bitcode / Writer / BitcodeVerifier.cpp
1 //===--- Bitcode/Writer/BitcodeVerifier.cpp - Bitcode Writer ----------===//
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 // BitcodeVerifier implementation.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "llvm/Pass.h"
15 #include "llvm/Bitcode/ReaderWriter.h"
16 #include "llvm/Support/Debug.h"
17 #include "llvm/Support/raw_ostream.h"
18
19 using namespace llvm;
20
21 namespace {
22   struct VerifyBitcode : public ModulePass {
23     raw_ostream &OS; // raw_ostream to read from
24   public:
25     static char ID; // Pass identification, replacement for typeid
26     explicit VerifyBitcode(raw_ostream &o)
27       : ModulePass(ID), OS(o) {}
28     
29     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
30     }
31
32     const char *getPassName() const { return "Bitcode Verifier"; }
33     
34     bool runOnModule(Module &M) {
35       Verify(M);
36       return false;
37     }
38
39     void Verify(Module &M);
40   };
41 }
42
43 char VerifyBitcode::ID = 0;
44
45 /// createBitcodeVerifierPass - Create a pass that writes a module to disk and
46 /// then reads the module back in to verify bitcode serialization and
47 /// deserialization.
48 ModulePass *llvm::createBitcodeVerifierPass(raw_ostream &Str) {
49   return new VerifyBitcode(Str);
50 }
51
52 void VerifyBitcode::Verify(Module &M) {
53   dbgs() << "BitcodeVerifier!\n";
54 }