[llvm-commits] [llvm] r170767 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/AttributeImpl.h lib/VMCore/Attributes.cpp
Bill Wendling
isanbard at gmail.com
Thu Dec 20 13:28:44 PST 2012
Author: void
Date: Thu Dec 20 15:28:43 2012
New Revision: 170767
URL: http://llvm.org/viewvc/llvm-project?rev=170767&view=rev
Log:
Some random comment, naming, and format changes.
Rename the AttributeImpl* from Attrs to pImpl to be consistent with other code.
Add comments where none were before. Or doxygen-ify other comments.
Modified:
llvm/trunk/include/llvm/Attributes.h
llvm/trunk/lib/VMCore/AttributeImpl.h
llvm/trunk/lib/VMCore/Attributes.cpp
Modified: llvm/trunk/include/llvm/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=170767&r1=170766&r2=170767&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Attributes.h (original)
+++ llvm/trunk/include/llvm/Attributes.h Thu Dec 20 15:28:43 2012
@@ -6,10 +6,11 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-//
-// This file contains the simple types necessary to represent the
-// attributes associated with functions and their calls.
-//
+///
+/// \file
+/// \brief This file contains the simple types necessary to represent the
+/// attributes associated with functions and their calls.
+///
//===----------------------------------------------------------------------===//
#ifndef LLVM_ATTRIBUTES_H
@@ -28,7 +29,8 @@
class Type;
//===----------------------------------------------------------------------===//
-/// \class Functions, function parameters, and return types can have attributes
+/// \class
+/// \brief Functions, function parameters, and return types can have attributes
/// to indicate how they should be treated by optimizations and code
/// generation. This class represents one of those attributes. It's light-weight
/// and should be passed around by-value.
@@ -91,10 +93,10 @@
ZExt ///< Zero extended before/after call
};
private:
- AttributeImpl *Attrs;
- Attribute(AttributeImpl *A) : Attrs(A) {}
+ AttributeImpl *pImpl;
+ Attribute(AttributeImpl *A) : pImpl(A) {}
public:
- Attribute() : Attrs(0) {}
+ Attribute() : pImpl(0) {}
/// \brief Return a uniquified Attribute object. This takes the uniquified
/// value from the Builder and wraps it in the Attribute class.
@@ -119,10 +121,10 @@
unsigned getStackAlignment() const;
bool operator==(const Attribute &A) const {
- return Attrs == A.Attrs;
+ return pImpl == A.pImpl;
}
bool operator!=(const Attribute &A) const {
- return Attrs != A.Attrs;
+ return pImpl != A.pImpl;
}
uint64_t Raw() const;
@@ -148,10 +150,11 @@
};
//===----------------------------------------------------------------------===//
-/// AttrBuilder - This class is used in conjunction with the Attribute::get
-/// method to create an Attribute object. The object itself is uniquified. The
-/// Builder's value, however, is not. So this can be used as a quick way to test
-/// for equality, presence of attributes, etc.
+/// \class
+/// \brief This class is used in conjunction with the Attribute::get method to
+/// create an Attribute object. The object itself is uniquified. The Builder's
+/// value, however, is not. So this can be used as a quick way to test for
+/// equality, presence of attributes, etc.
class AttrBuilder {
uint64_t Bits;
public:
@@ -173,7 +176,7 @@
/// removeAttribute - Remove the attributes from A from the builder.
AttrBuilder &removeAttributes(const Attribute &A);
- /// hasAttribute - Return true if the builder has the specified attribute.
+ /// contains - Return true if the builder has the specified attribute.
bool hasAttribute(Attribute::AttrVal A) const;
/// hasAttributes - Return true if the builder has IR-level attributes.
@@ -239,7 +242,8 @@
};
//===----------------------------------------------------------------------===//
-/// \class This is just a pair of values to associate a set of attributes with
+/// \class
+/// \brief This is just a pair of values to associate a set of attributes with
/// an index.
struct AttributeWithIndex {
Attribute Attrs; ///< The attributes that are set, or'd together.
@@ -266,7 +270,8 @@
class AttributeSetImpl;
//===----------------------------------------------------------------------===//
-/// \class This class manages the ref count for the opaque AttributeSetImpl
+/// \class
+/// \brief This class manages the ref count for the opaque AttributeSetImpl
/// object and provides accessors for it.
class AttributeSet {
public:
@@ -381,6 +386,6 @@
void dump() const;
};
-} // End llvm namespace
+} // end llvm namespace
#endif
Modified: llvm/trunk/lib/VMCore/AttributeImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AttributeImpl.h?rev=170767&r1=170766&r2=170767&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AttributeImpl.h (original)
+++ llvm/trunk/lib/VMCore/AttributeImpl.h Thu Dec 20 15:28:43 2012
@@ -6,10 +6,11 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-//
-// This file defines various helper methods and classes used by LLVMContextImpl
-// for creating and managing attributes.
-//
+///
+/// \file
+/// \brief This file defines various helper methods and classes used by
+/// LLVMContextImpl for creating and managing attributes.
+///
//===----------------------------------------------------------------------===//
#ifndef LLVM_ATTRIBUTESIMPL_H
@@ -22,6 +23,11 @@
class LLVMContext;
+//===----------------------------------------------------------------------===//
+/// \class
+/// \brief This class represents a single, uniqued attribute. That attribute
+/// could be a single enum, a tuple, or a string. It uses a discriminated union
+/// to distinguish them.
class AttributeImpl : public FoldingSetNode {
uint64_t Bits; // FIXME: We will be expanding this.
public:
@@ -47,6 +53,9 @@
}
};
+//===----------------------------------------------------------------------===//
+/// \class
+/// \brief This class represents a set of attributes.
class AttributeSetImpl : public FoldingSetNode {
// AttributesList is uniqued, these should not be publicly available.
void operator=(const AttributeSetImpl &) LLVM_DELETED_FUNCTION;
Modified: llvm/trunk/lib/VMCore/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=170767&r1=170766&r2=170767&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Attributes.cpp (original)
+++ llvm/trunk/lib/VMCore/Attributes.cpp Thu Dec 20 15:28:43 2012
@@ -62,22 +62,22 @@
}
bool Attribute::hasAttribute(AttrVal Val) const {
- return Attrs && Attrs->hasAttribute(Val);
+ return pImpl && pImpl->hasAttribute(Val);
}
bool Attribute::hasAttributes() const {
- return Attrs && Attrs->hasAttributes();
+ return pImpl && pImpl->hasAttributes();
}
bool Attribute::hasAttributes(const Attribute &A) const {
- return Attrs && Attrs->hasAttributes(A);
+ return pImpl && pImpl->hasAttributes(A);
}
/// This returns the alignment field of an attribute as a byte alignment value.
unsigned Attribute::getAlignment() const {
if (!hasAttribute(Attribute::Alignment))
return 0;
- return 1U << ((Attrs->getAlignment() >> 16) - 1);
+ return 1U << ((pImpl->getAlignment() >> 16) - 1);
}
/// This returns the stack alignment field of an attribute as a byte alignment
@@ -85,11 +85,11 @@
unsigned Attribute::getStackAlignment() const {
if (!hasAttribute(Attribute::StackAlignment))
return 0;
- return 1U << ((Attrs->getStackAlignment() >> 26) - 1);
+ return 1U << ((pImpl->getStackAlignment() >> 26) - 1);
}
uint64_t Attribute::Raw() const {
- return Attrs ? Attrs->Raw() : 0;
+ return pImpl ? pImpl->Raw() : 0;
}
Attribute Attribute::typeIncompatible(Type *Ty) {
@@ -398,8 +398,6 @@
//===----------------------------------------------------------------------===//
const AttributeSet &AttributeSet::operator=(const AttributeSet &RHS) {
- if (AttrList == RHS.AttrList) return *this;
-
AttrList = RHS.AttrList;
return *this;
}
More information about the llvm-commits
mailing list