[llvm] r271584 - fix documentation comments; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 13:37:52 PDT 2016


Author: spatel
Date: Thu Jun  2 15:37:52 2016
New Revision: 271584

URL: http://llvm.org/viewvc/llvm-project?rev=271584&view=rev
Log:
fix documentation comments; NFC

Modified:
    llvm/trunk/include/llvm/IR/Type.h
    llvm/trunk/lib/IR/Type.cpp

Modified: llvm/trunk/include/llvm/IR/Type.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Type.h?rev=271584&r1=271583&r2=271584&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Type.h (original)
+++ llvm/trunk/include/llvm/IR/Type.h Thu Jun  2 15:37:52 2016
@@ -76,7 +76,7 @@ public:
   };
 
 private:
-  /// Context - This refers to the LLVMContext in which this type was uniqued.
+  /// This refers to the LLVMContext in which this type was uniqued.
   LLVMContext &Context;
 
   TypeID   ID : 8;            // The current base type of this type.
@@ -97,15 +97,14 @@ protected:
     assert(getSubclassData() == val && "Subclass data too large for field");
   }
 
-  /// NumContainedTys - Keeps track of how many Type*'s there are in the
-  /// ContainedTys list.
+  /// Keeps track of how many Type*'s there are in the ContainedTys list.
   unsigned NumContainedTys;
 
-  /// ContainedTys - A pointer to the array of Types contained by this Type.
-  /// For example, this includes the arguments of a function type, the elements
-  /// of a structure, the pointee of a pointer, the element type of an array,
-  /// etc.  This pointer may be 0 for types that don't contain other types
-  /// (Integer, Double, Float).
+  /// A pointer to the array of Types contained by this Type. For example, this
+  /// includes the arguments of a function type, the elements of a structure,
+  /// the pointee of a pointer, the element type of an array, etc. This pointer
+  /// may be 0 for types that don't contain other types (Integer, Double,
+  /// Float).
   Type * const *ContainedTys;
 
   static bool isSequentialType(TypeID TyID) {
@@ -123,41 +122,39 @@ public:
              bool NoDetails = false) const;
   void dump() const;
 
-  /// getContext - Return the LLVMContext in which this type was uniqued.
+  /// Return the LLVMContext in which this type was uniqued.
   LLVMContext &getContext() const { return Context; }
 
   //===--------------------------------------------------------------------===//
   // Accessors for working with types.
   //
 
-  /// getTypeID - Return the type id for the type.  This will return one
-  /// of the TypeID enum elements defined above.
-  ///
+  /// Return the type id for the type. This will return one of the TypeID enum
+  /// elements defined above.
   TypeID getTypeID() const { return ID; }
 
-  /// isVoidTy - Return true if this is 'void'.
+  /// Return true if this is 'void'.
   bool isVoidTy() const { return getTypeID() == VoidTyID; }
 
-  /// isHalfTy - Return true if this is 'half', a 16-bit IEEE fp type.
+  /// Return true if this is 'half', a 16-bit IEEE fp type.
   bool isHalfTy() const { return getTypeID() == HalfTyID; }
 
-  /// isFloatTy - Return true if this is 'float', a 32-bit IEEE fp type.
+  /// Return true if this is 'float', a 32-bit IEEE fp type.
   bool isFloatTy() const { return getTypeID() == FloatTyID; }
 
-  /// isDoubleTy - Return true if this is 'double', a 64-bit IEEE fp type.
+  /// Return true if this is 'double', a 64-bit IEEE fp type.
   bool isDoubleTy() const { return getTypeID() == DoubleTyID; }
 
-  /// isX86_FP80Ty - Return true if this is x86 long double.
+  /// Return true if this is x86 long double.
   bool isX86_FP80Ty() const { return getTypeID() == X86_FP80TyID; }
 
-  /// isFP128Ty - Return true if this is 'fp128'.
+  /// Return true if this is 'fp128'.
   bool isFP128Ty() const { return getTypeID() == FP128TyID; }
 
-  /// isPPC_FP128Ty - Return true if this is powerpc long double.
+  /// Return true if this is powerpc long double.
   bool isPPC_FP128Ty() const { return getTypeID() == PPC_FP128TyID; }
 
-  /// isFloatingPointTy - Return true if this is one of the six floating point
-  /// types
+  /// Return true if this is one of the six floating-point types
   bool isFloatingPointTy() const {
     return getTypeID() == HalfTyID || getTypeID() == FloatTyID ||
            getTypeID() == DoubleTyID ||
@@ -177,99 +174,81 @@ public:
     }
   }
 
-  /// isX86_MMXTy - Return true if this is X86 MMX.
+  /// Return true if this is X86 MMX.
   bool isX86_MMXTy() const { return getTypeID() == X86_MMXTyID; }
 
-  /// isFPOrFPVectorTy - Return true if this is a FP type or a vector of FP.
-  ///
+  /// Return true if this is a FP type or a vector of FP.
   bool isFPOrFPVectorTy() const { return getScalarType()->isFloatingPointTy(); }
 
-  /// isLabelTy - Return true if this is 'label'.
+  /// Return true if this is 'label'.
   bool isLabelTy() const { return getTypeID() == LabelTyID; }
 
-  /// isMetadataTy - Return true if this is 'metadata'.
+  /// Return true if this is 'metadata'.
   bool isMetadataTy() const { return getTypeID() == MetadataTyID; }
 
-  /// isTokenTy - Return true if this is 'token'.
+  /// Return true if this is 'token'.
   bool isTokenTy() const { return getTypeID() == TokenTyID; }
 
-  /// isIntegerTy - True if this is an instance of IntegerType.
-  ///
+  /// True if this is an instance of IntegerType.
   bool isIntegerTy() const { return getTypeID() == IntegerTyID; }
 
-  /// isIntegerTy - Return true if this is an IntegerType of the given width.
+  /// Return true if this is an IntegerType of the given width.
   bool isIntegerTy(unsigned Bitwidth) const;
 
-  /// isIntOrIntVectorTy - Return true if this is an integer type or a vector of
-  /// integer types.
-  ///
+  /// Return true if this is an integer type or a vector of integer types.
   bool isIntOrIntVectorTy() const { return getScalarType()->isIntegerTy(); }
 
-  /// isFunctionTy - True if this is an instance of FunctionType.
-  ///
+  /// True if this is an instance of FunctionType.
   bool isFunctionTy() const { return getTypeID() == FunctionTyID; }
 
-  /// isStructTy - True if this is an instance of StructType.
-  ///
+  /// True if this is an instance of StructType.
   bool isStructTy() const { return getTypeID() == StructTyID; }
 
-  /// isArrayTy - True if this is an instance of ArrayType.
-  ///
+  /// True if this is an instance of ArrayType.
   bool isArrayTy() const { return getTypeID() == ArrayTyID; }
 
-  /// isPointerTy - True if this is an instance of PointerType.
-  ///
+  /// True if this is an instance of PointerType.
   bool isPointerTy() const { return getTypeID() == PointerTyID; }
 
-  /// isPtrOrPtrVectorTy - Return true if this is a pointer type or a vector of
-  /// pointer types.
-  ///
+  /// Return true if this is a pointer type or a vector of pointer types.
   bool isPtrOrPtrVectorTy() const { return getScalarType()->isPointerTy(); }
 
-  /// isVectorTy - True if this is an instance of VectorType.
-  ///
+  /// True if this is an instance of VectorType.
   bool isVectorTy() const { return getTypeID() == VectorTyID; }
 
-  /// canLosslesslyBitCastTo - Return true if this type could be converted
-  /// with a lossless BitCast to type 'Ty'. For example, i8* to i32*. BitCasts
-  /// are valid for types of the same size only where no re-interpretation of
-  /// the bits is done.
+  /// Return true if this type could be converted with a lossless BitCast to
+  /// type 'Ty'. For example, i8* to i32*. BitCasts are valid for types of the
+  /// same size only where no re-interpretation of the bits is done.
   /// @brief Determine if this type could be losslessly bitcast to Ty
   bool canLosslesslyBitCastTo(Type *Ty) const;
 
-  /// isEmptyTy - Return true if this type is empty, that is, it has no
-  /// elements or all its elements are empty.
+  /// Return true if this type is empty, that is, it has no elements or all of
+  /// its elements are empty.
   bool isEmptyTy() const;
 
-  /// isFirstClassType - Return true if the type is "first class", meaning it
-  /// is a valid type for a Value.
-  ///
+  /// Return true if the type is "first class", meaning it is a valid type for a
+  /// Value.
   bool isFirstClassType() const {
     return getTypeID() != FunctionTyID && getTypeID() != VoidTyID;
   }
 
-  /// isSingleValueType - Return true if the type is a valid type for a
-  /// register in codegen.  This includes all first-class types except struct
-  /// and array types.
-  ///
+  /// Return true if the type is a valid type for a register in codegen. This
+  /// includes all first-class types except struct and array types.
   bool isSingleValueType() const {
     return isFloatingPointTy() || isX86_MMXTy() || isIntegerTy() ||
            isPointerTy() || isVectorTy();
   }
 
-  /// isAggregateType - Return true if the type is an aggregate type. This
-  /// means it is valid as the first operand of an insertvalue or
-  /// extractvalue instruction. This includes struct and array types, but
-  /// does not include vector types.
-  ///
+  /// Return true if the type is an aggregate type. This means it is valid as
+  /// the first operand of an insertvalue or extractvalue instruction. This
+  /// includes struct and array types, but does not include vector types.
   bool isAggregateType() const {
     return getTypeID() == StructTyID || getTypeID() == ArrayTyID;
   }
 
-  /// isSized - Return true if it makes sense to take the size of this type.  To
-  /// get the actual size for a particular target, it is reasonable to use the
+  /// Return true if it makes sense to take the size of this type. To get the
+  /// actual size for a particular target, it is reasonable to use the
   /// DataLayout subsystem to do this.
-  ///
   bool isSized(SmallPtrSetImpl<Type*> *Visited = nullptr) const {
     // If it's a primitive, it is always sized.
     if (getTypeID() == IntegerTyID || isFloatingPointTy() ||
@@ -285,8 +264,8 @@ public:
     return isSizedDerivedType(Visited);
   }
 
-  /// getPrimitiveSizeInBits - Return the basic size of this type if it is a
-  /// primitive type.  These are fixed by LLVM and are not target dependent.
+  /// Return the basic size of this type if it is a primitive type. These are
+  /// fixed by LLVM and are not target-dependent.
   /// This will return zero if the type does not have a size or is not a
   /// primitive type.
   ///
@@ -297,18 +276,18 @@ public:
   ///
   unsigned getPrimitiveSizeInBits() const LLVM_READONLY;
 
-  /// getScalarSizeInBits - If this is a vector type, return the
-  /// getPrimitiveSizeInBits value for the element type. Otherwise return the
-  /// getPrimitiveSizeInBits value for this type.
+  /// If this is a vector type, return the getPrimitiveSizeInBits value for the
+  /// element type. Otherwise return the getPrimitiveSizeInBits value for this
+  /// type.
   unsigned getScalarSizeInBits() const LLVM_READONLY;
 
-  /// getFPMantissaWidth - Return the width of the mantissa of this type.  This
-  /// is only valid on floating point types.  If the FP type does not
-  /// have a stable mantissa (e.g. ppc long double), this method returns -1.
+  /// Return the width of the mantissa of this type. This is only valid on
+  /// floating-point types. If the FP type does not have a stable mantissa (e.g.
+  /// ppc long double), this method returns -1.
   int getFPMantissaWidth() const;
 
-  /// getScalarType - If this is a vector type, return the element type,
-  /// otherwise return 'this'.
+  /// If this is a vector type, return the element type, otherwise return
+  /// 'this'.
   Type *getScalarType() const LLVM_READONLY;
 
   //===--------------------------------------------------------------------===//
@@ -329,17 +308,15 @@ public:
     return subtype_reverse_iterator(subtype_begin());
   }
 
-  /// getContainedType - This method is used to implement the type iterator
-  /// (defined at the end of the file).  For derived types, this returns the
-  /// types 'contained' in the derived type.
-  ///
+  /// This method is used to implement the type iterator (defined at the end of
+  /// the file). For derived types, this returns the types 'contained' in the
+  /// derived type.
   Type *getContainedType(unsigned i) const {
     assert(i < NumContainedTys && "Index out of range!");
     return ContainedTys[i];
   }
 
-  /// getNumContainedTypes - Return the number of types in the derived type.
-  ///
+  /// Return the number of types in the derived type.
   unsigned getNumContainedTypes() const { return NumContainedTys; }
 
   //===--------------------------------------------------------------------===//
@@ -372,7 +349,7 @@ public:
 
   Type *getPointerElementType() const { return getSequentialElementType(); }
 
-  /// \brief Get the address space of this pointer or pointer vector type.
+  /// Get the address space of this pointer or pointer vector type.
   inline unsigned getPointerAddressSpace() const;
 
   //===--------------------------------------------------------------------===//
@@ -380,7 +357,7 @@ public:
   // instances of Type.
   //
 
-  /// getPrimitiveType - Return a type based on an identifier.
+  /// Return a type based on an identifier.
   static Type *getPrimitiveType(LLVMContext &C, TypeID IDNumber);
 
   //===--------------------------------------------------------------------===//
@@ -423,14 +400,14 @@ public:
   static PointerType *getInt32PtrTy(LLVMContext &C, unsigned AS = 0);
   static PointerType *getInt64PtrTy(LLVMContext &C, unsigned AS = 0);
 
-  /// getPointerTo - Return a pointer to the current type.  This is equivalent
-  /// to PointerType::get(Foo, AddrSpace).
+  /// Return a pointer to the current type. This is equivalent to
+  /// PointerType::get(Foo, AddrSpace).
   PointerType *getPointerTo(unsigned AddrSpace = 0) const;
 
 private:
-  /// isSizedDerivedType - Derived types like structures and arrays are sized
-  /// iff all of the members of the type are sized as well.  Since asking for
-  /// their size is relatively uncommon, move this operation out of line.
+  /// Derived types like structures and arrays are sized iff all of the members
+  /// of the type are sized as well. Since asking for their size is relatively
+  /// uncommon, move this operation out-of-line.
   bool isSizedDerivedType(SmallPtrSetImpl<Type*> *Visited = nullptr) const;
 };
 

Modified: llvm/trunk/lib/IR/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Type.cpp?rev=271584&r1=271583&r2=271584&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Type.cpp (original)
+++ llvm/trunk/lib/IR/Type.cpp Thu Jun  2 15:37:52 2016
@@ -41,22 +41,16 @@ Type *Type::getPrimitiveType(LLVMContext
   }
 }
 
-/// getScalarType - If this is a vector type, return the element type,
-/// otherwise return this.
 Type *Type::getScalarType() const {
   if (auto *VTy = dyn_cast<VectorType>(this))
     return VTy->getElementType();
   return const_cast<Type*>(this);
 }
 
-/// isIntegerTy - Return true if this is an IntegerType of the specified width.
 bool Type::isIntegerTy(unsigned Bitwidth) const {
   return isIntegerTy() && cast<IntegerType>(this)->getBitWidth() == Bitwidth;
 }
 
-// canLosslesslyBitCastTo - Return true if this type can be converted to
-// 'Ty' without any reinterpretation of bits.  For example, i8* to i32*.
-//
 bool Type::canLosslesslyBitCastTo(Type *Ty) const {
   // Identity cast means no change so return true
   if (this == Ty) 
@@ -126,16 +120,10 @@ unsigned Type::getPrimitiveSizeInBits()
   }
 }
 
-/// getScalarSizeInBits - If this is a vector type, return the
-/// getPrimitiveSizeInBits value for the element type. Otherwise return the
-/// getPrimitiveSizeInBits value for this type.
 unsigned Type::getScalarSizeInBits() const {
   return getScalarType()->getPrimitiveSizeInBits();
 }
 
-/// getFPMantissaWidth - Return the width of the mantissa of this type.  This
-/// is only valid on floating point types.  If the FP type does not
-/// have a stable mantissa (e.g. ppc long double), this method returns -1.
 int Type::getFPMantissaWidth() const {
   if (auto *VTy = dyn_cast<VectorType>(this))
     return VTy->getElementType()->getFPMantissaWidth();
@@ -149,9 +137,6 @@ int Type::getFPMantissaWidth() const {
   return -1;
 }
 
-/// isSizedDerivedType - Derived types like structures and arrays are sized
-/// iff all of the members of the type are sized as well.  Since asking for
-/// their size is relatively uncommon, move this operation out of line.
 bool Type::isSizedDerivedType(SmallPtrSetImpl<Type*> *Visited) const {
   if (auto *ATy = dyn_cast<ArrayType>(this))
     return ATy->getElementType()->isSized(Visited);
@@ -302,7 +287,7 @@ FunctionType::FunctionType(Type *Result,
   NumContainedTys = Params.size() + 1; // + 1 for result type
 }
 
-// FunctionType::get - The factory function for the FunctionType class.
+// This is the factory function for the FunctionType class.
 FunctionType *FunctionType::get(Type *ReturnType,
                                 ArrayRef<Type*> Params, bool isVarArg) {
   LLVMContextImpl *pImpl = ReturnType->getContext().pImpl;
@@ -327,15 +312,11 @@ FunctionType *FunctionType::get(Type *Re
   return get(Result, None, isVarArg);
 }
 
-/// isValidReturnType - Return true if the specified type is valid as a return
-/// type.
 bool FunctionType::isValidReturnType(Type *RetTy) {
   return !RetTy->isFunctionTy() && !RetTy->isLabelTy() &&
   !RetTy->isMetadataTy();
 }
 
-/// isValidArgumentType - Return true if the specified type is valid as an
-/// argument type.
 bool FunctionType::isValidArgumentType(Type *ArgTy) {
   return ArgTy->isFirstClassType();
 }
@@ -552,8 +533,6 @@ bool StructType::isValidElementType(Type
          !ElemTy->isTokenTy();
 }
 
-/// isLayoutIdentical - Return true if this is layout identical to the
-/// specified struct.
 bool StructType::isLayoutIdentical(StructType *Other) const {
   if (this == Other) return true;
 
@@ -563,8 +542,6 @@ bool StructType::isLayoutIdentical(Struc
   return elements() == Other->elements();
 }
 
-/// getTypeByName - Return the type with the specified name, or null if there
-/// is none by that name.
 StructType *Module::getTypeByName(StringRef Name) const {
   return getContext().pImpl->NamedStructTypes.lookup(Name);
 }




More information about the llvm-commits mailing list