simplify trivial function
[oota-llvm.git] / include / llvm / SymbolTable.h
index 86df3178a1432663be54f24116914c06de60c038..52a2c29ea7814917fa0dfbd5b42c0f01c71cee75 100644 (file)
@@ -1,11 +1,11 @@
 //===-- llvm/SymbolTable.h - Implement a type plane'd symtab ----*- C++ -*-===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and re-written by Reid
-// Spencer. It is distributed under the University of Illinois Open Source 
+// Spencer. It is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This file implements the main symbol table for LLVM.
 #define LLVM_SYMBOL_TABLE_H
 
 #include "llvm/Value.h"
+#include "llvm/Support/DataTypes.h"
 #include <map>
 
 namespace llvm {
 
 /// This class provides a symbol table of name/value pairs that is broken
-/// up by type. For each Type* there is a "plane" of name/value pairs in 
-/// the symbol table.  Identical types may have overlapping symbol names as 
-/// long as they are distinct. The SymbolTable also tracks,  separately, a 
-/// map of name/type pairs. This allows types to be named. Types are treated 
+/// up by type. For each Type* there is a "plane" of name/value pairs in
+/// the symbol table.  Identical types may have overlapping symbol names as
+/// long as they are distinct. The SymbolTable also tracks,  separately, a
+/// map of name/type pairs. This allows types to be named. Types are treated
 /// distinctly from Values.
-/// 
+///
 /// The SymbolTable provides several utility functions for answering common
 /// questions about its contents as well as an iterator interface for
-/// directly iterating over the contents. To reduce confusion, the terms 
+/// directly iterating over the contents. To reduce confusion, the terms
 /// "type", "value", and "plane" are used consistently. For example,
-/// There is a TypeMap typedef that is the mapping of names to Types. 
-/// Similarly there is a ValueMap typedef that is the mapping of 
+/// There is a TypeMap typedef that is the mapping of names to Types.
+/// Similarly there is a ValueMap typedef that is the mapping of
 /// names to Values. Finally, there is a PlaneMap typedef that is the
 /// mapping of types to planes of ValueMap. This is the basic structure
 /// of the symbol table. When you call type_begin() you're asking
 /// for an iterator at the start of the TypeMap. When you call
-/// plane_begin(), you're asking for an iterator at the start of 
+/// plane_begin(), you're asking for an iterator at the start of
 /// the PlaneMap. Finally, when you call value_begin(), you're asking
 /// for an iterator at the start of a ValueMap for a specific type
 /// plane.
@@ -102,25 +103,25 @@ public:
   /// @brief Lookup a type by name.
   Type* lookupType(const std::string& name) const;
 
-  /// @returns true iff the type map and the type plane are both not 
+  /// @returns true iff the type map and the type plane are both not
   /// empty.
   /// @brief Determine if the symbol table is empty
   inline bool isEmpty() const { return pmap.empty() && tmap.empty(); }
 
   /// @brief The number of name/type pairs is returned.
-  inline unsigned num_types() const { return (unsigned)tmap.size(); }
+  inline unsigned num_types() const { return unsigned(tmap.size()); }
 
-  /// Given a base name, return a string that is either equal to it or 
-  /// derived from it that does not already occur in the symbol table 
+  /// Given a base name, return a string that is either equal to it or
+  /// derived from it that does not already occur in the symbol table
   /// for the specified type.
   /// @brief Get a name unique to this symbol table
-  std::string getUniqueName(const Type *Ty, 
+  std::string getUniqueName(const Type *Ty,
                             const std::string &BaseName) const;
 
   /// This function can be used from the debugger to display the
   /// content of the symbol table while debugging.
   /// @brief Print out symbol table on stderr
-  void dump() const;  
+  void dump() const;
 
 /// @}
 /// @name Iteration
@@ -129,12 +130,12 @@ public:
 
   /// Get an iterator that starts at the beginning of the type planes.
   /// The iterator will iterate over the Type/ValueMap pairs in the
-  /// type planes. 
+  /// type planes.
   inline plane_iterator plane_begin() { return pmap.begin(); }
 
-  /// Get a const_iterator that starts at the beginning of the type 
-  /// planes.  The iterator will iterate over the Type/ValueMap pairs 
-  /// in the type planes. 
+  /// Get a const_iterator that starts at the beginning of the type
+  /// planes.  The iterator will iterate over the Type/ValueMap pairs
+  /// in the type planes.
   inline plane_const_iterator plane_begin() const { return pmap.begin(); }
 
   /// Get an iterator at the end of the type planes. This serves as
@@ -148,9 +149,9 @@ public:
   /// Get an iterator that starts at the beginning of a type plane.
   /// The iterator will iterate over the name/value pairs in the type plane.
   /// @note The type plane must already exist before using this.
-  inline value_iterator value_begin(const Type *Typ) { 
+  inline value_iterator value_begin(const Type *Typ) {
     assert(Typ && "Can't get value iterator with null type!");
-    return pmap.find(Typ)->second.begin(); 
+    return pmap.find(Typ)->second.begin();
   }
 
   /// Get a const_iterator that starts at the beginning of a type plane.
@@ -158,23 +159,23 @@ public:
   /// @note The type plane must already exist before using this.
   inline value_const_iterator value_begin(const Type *Typ) const {
     assert(Typ && "Can't get value iterator with null type!");
-    return pmap.find(Typ)->second.begin(); 
+    return pmap.find(Typ)->second.begin();
   }
 
   /// Get an iterator to the end of a type plane. This serves as the marker
   /// for end of iteration of the type plane.
   /// @note The type plane must already exist before using this.
-  inline value_iterator value_end(const Type *Typ) { 
+  inline value_iterator value_end(const Type *Typ) {
     assert(Typ && "Can't get value iterator with null type!");
-    return pmap.find(Typ)->second.end(); 
+    return pmap.find(Typ)->second.end();
   }
 
   /// Get a const_iterator to the end of a type plane. This serves as the
   /// marker for end of iteration of the type plane.
   /// @note The type plane must already exist before using this.
-  inline value_const_iterator value_end(const Type *Typ) const { 
+  inline value_const_iterator value_end(const Type *Typ) const {
     assert(Typ && "Can't get value iterator with null type!");
-    return pmap.find(Typ)->second.end(); 
+    return pmap.find(Typ)->second.end();
   }
 
   /// Get an iterator to the start of the name/Type map.
@@ -187,7 +188,7 @@ public:
   /// marker for end of iteration of the types.
   inline type_iterator type_end() { return tmap.end(); }
 
-  /// Get a const-iterator to the end of the name/Type map. This serves 
+  /// Get a const-iterator to the end of the name/Type map. This serves
   /// as the marker for end of iteration of the types.
   inline type_const_iterator type_end() const { return tmap.end(); }
 
@@ -202,9 +203,9 @@ public:
   /// This method returns a plane_iterator for iteration over the
   /// type planes starting at a specific plane, given by \p Ty.
   /// @brief Find a type plane.
-  inline plane_iterator find(const Type* Typ) { 
+  inline plane_iterator find(const Type* Typ) {
     assert(Typ && "Can't find type plane with null type!");
-    return pmap.find(Typ); 
+    return pmap.find(Typ);
   }
 
 
@@ -265,7 +266,7 @@ private:
   /// @brief Insert a value into the symbol table with the specified name.
   void insertEntry(const std::string &Name, const Type *Ty, Value *V);
 
-  /// This function is called when one of the types in the type plane 
+  /// This function is called when one of the types in the type plane
   /// is refined.
   virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
 
@@ -273,26 +274,26 @@ private:
   virtual void typeBecameConcrete(const DerivedType *AbsTy);
 
 /// @}
-/// @name Internal Data 
+/// @name Internal Data
 /// @{
 private:
 
   /// This is the main content of the symbol table. It provides
   /// separate type planes for named values. That is, each named
-  /// value is organized into a separate dictionary based on 
+  /// value is organized into a separate dictionary based on
   /// Type. This means that the same name can be used for different
-  /// types without conflict. 
+  /// types without conflict.
   /// @brief The mapping of types to names to values.
   PlaneMap pmap;
 
   /// This is the type plane. It is separated from the pmap
-  /// because the elements of the map are name/Type pairs not 
+  /// because the elements of the map are name/Type pairs not
   /// name/Value pairs and Type is not a Value.
   TypeMap tmap;
 
   /// This value is used to retain the last unique value used
   /// by getUniqueName to generate unique names.
-  mutable unsigned long LastUnique;
+  mutable uint32_t LastUnique;
 
 /// @}