~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/include/llvm/MC/MCSymbol.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-03-12 11:30:04 UTC
  • mfrom: (0.41.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100312113004-b0fop4bkycszdd0z
Tags: 0.96~rc1+dfsg-0ubuntu1
* New upstream RC - FFE (LP: #537636):
  - Add OfficialDatabaseOnly option to clamav-base.postinst.in
  - Add LocalSocketGroup option to clamav-base.postinst.in
  - Add LocalSocketMode option to clamav-base.postinst.in
  - Add CrossFilesystems option to clamav-base.postinst.in
  - Add ClamukoScannerCount option to clamav-base.postinst.in
  - Add BytecodeSecurity opiton to clamav-base.postinst.in
  - Add DetectionStatsHostID option to clamav-freshclam.postinst.in
  - Add Bytecode option to clamav-freshclam.postinst.in
  - Add MilterSocketGroup option to clamav-milter.postinst.in
  - Add MilterSocketMode option to clamav-milter.postinst.in
  - Add ReportHostname option to clamav-milter.postinst.in
  - Bump libclamav SO version to 6.1.0 in libclamav6.install
  - Drop clamdmon from clamav.examples (no longer shipped by upstream)
  - Drop libclamav.a from libclamav-dev.install (not built by upstream)
  - Update SO version for lintian override for libclamav6
  - Add new Bytecode Testing Tool, usr/bin/clambc, to clamav.install
  - Add build-depends on python and python-setuptools for new test suite
  - Update debian/copyright for the embedded copy of llvm (using the system
    llvm is not currently feasible)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===- MCSymbol.h - Machine Code Symbols ------------------------*- 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 file contains the declaration of the MCSymbol class.
 
11
//
 
12
//===----------------------------------------------------------------------===//
 
13
 
 
14
#ifndef LLVM_MC_MCSYMBOL_H
 
15
#define LLVM_MC_MCSYMBOL_H
 
16
 
 
17
#include <string>
 
18
#include "llvm/ADT/StringRef.h"
 
19
#include "llvm/System/DataTypes.h"
 
20
 
 
21
namespace llvm {
 
22
  class MCExpr;
 
23
  class MCSection;
 
24
  class MCContext;
 
25
  class raw_ostream;
 
26
 
 
27
  /// MCSymbol - Instances of this class represent a symbol name in the MC file,
 
28
  /// and MCSymbols are created and unique'd by the MCContext class.  MCSymbols
 
29
  /// should only be constructed with valid names for the object file.
 
30
  ///
 
31
  /// If the symbol is defined/emitted into the current translation unit, the
 
32
  /// Section member is set to indicate what section it lives in.  Otherwise, if
 
33
  /// it is a reference to an external entity, it has a null section.  
 
34
  /// 
 
35
  class MCSymbol {
 
36
    // Special sentinal value for the absolute pseudo section.
 
37
    //
 
38
    // FIXME: Use a PointerInt wrapper for this?
 
39
    static const MCSection *AbsolutePseudoSection;
 
40
 
 
41
    /// Name - The name of the symbol.
 
42
    std::string Name;
 
43
 
 
44
    /// Section - The section the symbol is defined in. This is null for
 
45
    /// undefined symbols, and the special AbsolutePseudoSection value for
 
46
    /// absolute symbols.
 
47
    const MCSection *Section;
 
48
 
 
49
    /// Value - If non-null, the value for a variable symbol.
 
50
    const MCExpr *Value;
 
51
 
 
52
    /// IsTemporary - True if this is an assembler temporary label, which
 
53
    /// typically does not survive in the .o file's symbol table.  Usually
 
54
    /// "Lfoo" or ".foo".
 
55
    unsigned IsTemporary : 1;
 
56
    
 
57
  private:  // MCContext creates and uniques these.
 
58
    friend class MCContext;
 
59
    MCSymbol(StringRef _Name, bool _IsTemporary)
 
60
      : Name(_Name), Section(0), Value(0), IsTemporary(_IsTemporary) {}
 
61
 
 
62
    MCSymbol(const MCSymbol&);       // DO NOT IMPLEMENT
 
63
    void operator=(const MCSymbol&); // DO NOT IMPLEMENT
 
64
  public:
 
65
    /// getName - Get the symbol name.
 
66
    const std::string &getName() const { return Name; }
 
67
 
 
68
    /// @name Symbol Type
 
69
    /// @{
 
70
 
 
71
    /// isTemporary - Check if this is an assembler temporary symbol.
 
72
    bool isTemporary() const {
 
73
      return IsTemporary;
 
74
    }
 
75
 
 
76
    /// @}
 
77
    /// @name Associated Sections
 
78
    /// @{
 
79
 
 
80
    /// isDefined - Check if this symbol is defined (i.e., it has an address).
 
81
    ///
 
82
    /// Defined symbols are either absolute or in some section.
 
83
    bool isDefined() const {
 
84
      return Section != 0;
 
85
    }
 
86
 
 
87
    /// isUndefined - Check if this symbol undefined (i.e., implicitly defined).
 
88
    bool isUndefined() const {
 
89
      return !isDefined();
 
90
    }
 
91
 
 
92
    /// isAbsolute - Check if this is an absolute symbol.
 
93
    bool isAbsolute() const {
 
94
      return Section == AbsolutePseudoSection;
 
95
    }
 
96
 
 
97
    /// getSection - Get the section associated with a defined, non-absolute
 
98
    /// symbol.
 
99
    const MCSection &getSection() const {
 
100
      assert(!isUndefined() && !isAbsolute() && "Invalid accessor!");
 
101
      return *Section;
 
102
    }
 
103
 
 
104
    /// setSection - Mark the symbol as defined in the section \arg S.
 
105
    void setSection(const MCSection &S) { Section = &S; }
 
106
 
 
107
    /// setUndefined - Mark the symbol as undefined.
 
108
    void setUndefined() {
 
109
      Section = 0;
 
110
    }
 
111
 
 
112
    /// setAbsolute - Mark the symbol as absolute.
 
113
    void setAbsolute() { Section = AbsolutePseudoSection; }
 
114
 
 
115
    /// @}
 
116
    /// @name Variable Symbols
 
117
    /// @{
 
118
 
 
119
    /// isVariable - Check if this is a variable symbol.
 
120
    bool isVariable() const {
 
121
      return Value != 0;
 
122
    }
 
123
 
 
124
    /// getValue() - Get the value for variable symbols, or null if the symbol
 
125
    /// is not a variable.
 
126
    const MCExpr *getValue() const { return Value; }
 
127
 
 
128
    void setValue(const MCExpr *Value) {
 
129
      this->Value = Value;
 
130
    }
 
131
 
 
132
    /// @}
 
133
 
 
134
    /// print - Print the value to the stream \arg OS.
 
135
    void print(raw_ostream &OS) const;
 
136
 
 
137
    /// dump - Print the value to stderr.
 
138
    void dump() const;
 
139
  };
 
140
 
 
141
  inline raw_ostream &operator<<(raw_ostream &OS, const MCSymbol &Sym) {
 
142
    Sym.print(OS);
 
143
    return OS;
 
144
  }
 
145
} // end namespace llvm
 
146
 
 
147
#endif