~ubuntu-branches/ubuntu/feisty/clamav/feisty

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/include/llvm/Analysis/FindUsedTypes.h

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2007-02-20 10:33:44 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20070220103344-zgcu2psnx9d98fpa
Tags: upstream-0.90
ImportĀ upstreamĀ versionĀ 0.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//===- llvm/Analysis/FindUsedTypes.h - Find all Types in use ----*- C++ -*-===//
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
 
// This pass is used to seek out all of the types in use by the program.
11
 
//
12
 
//===----------------------------------------------------------------------===//
13
 
 
14
 
#ifndef LLVM_ANALYSIS_FINDUSEDTYPES_H
15
 
#define LLVM_ANALYSIS_FINDUSEDTYPES_H
16
 
 
17
 
#include "llvm/Pass.h"
18
 
#include <set>
19
 
 
20
 
namespace llvm {
21
 
 
22
 
class Type;
23
 
class Value;
24
 
 
25
 
class FindUsedTypes : public ModulePass {
26
 
  std::set<const Type *> UsedTypes;
27
 
public:
28
 
  static char ID; // Pass identification, replacement for typeid
29
 
  FindUsedTypes() : ModulePass(ID) {}
30
 
 
31
 
  /// getTypes - After the pass has been run, return the set containing all of
32
 
  /// the types used in the module.
33
 
  ///
34
 
  const std::set<const Type *> &getTypes() const { return UsedTypes; }
35
 
 
36
 
  /// Print the types found in the module.  If the optional Module parameter is
37
 
  /// passed in, then the types are printed symbolically if possible, using the
38
 
  /// symbol table from the module.
39
 
  ///
40
 
  void print(raw_ostream &o, const Module *M) const;
41
 
 
42
 
private:
43
 
  /// IncorporateType - Incorporate one type and all of its subtypes into the
44
 
  /// collection of used types.
45
 
  ///
46
 
  void IncorporateType(const Type *Ty);
47
 
 
48
 
  /// IncorporateValue - Incorporate all of the types used by this value.
49
 
  ///
50
 
  void IncorporateValue(const Value *V);
51
 
 
52
 
public:
53
 
  /// run - This incorporates all types used by the specified module
54
 
  bool runOnModule(Module &M);
55
 
 
56
 
  /// getAnalysisUsage - We do not modify anything.
57
 
  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
58
 
    AU.setPreservesAll();
59
 
  }
60
 
};
61
 
 
62
 
} // End llvm namespace
63
 
 
64
 
#endif