[llvm-commits] CVS: llvm/include/llvm/Constants.h
Chris Lattner
sabre at nondot.org
Thu Sep 28 16:36:35 PDT 2006
Changes in directory llvm/include/llvm:
Constants.h updated: 1.87 -> 1.88
---
Log message:
Eliminate ConstantBool::True and ConstantBool::False. Instead, provide
ConstantBool::getTrue() and ConstantBool::getFalse().
---
Diffs of the changes: (+11 -7)
Constants.h | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.87 llvm/include/llvm/Constants.h:1.88
--- llvm/include/llvm/Constants.h:1.87 Sun Sep 17 23:58:06 2006
+++ llvm/include/llvm/Constants.h Thu Sep 28 18:36:21 2006
@@ -125,12 +125,14 @@
class ConstantBool : public ConstantIntegral {
ConstantBool(bool V);
public:
- static ConstantBool *True, *False; ///< The True & False values
+ /// getTrue/getFalse - Return the singleton true/false values.
+ static ConstantBool *getTrue();
+ static ConstantBool *getFalse();
/// This method is provided mostly for compatibility with the other
/// ConstantIntegral subclasses.
/// @brief Static factory method for getting a ConstantBool instance.
- static ConstantBool *get(bool Value) { return Value ? True : False; }
+ static ConstantBool *get(bool Value) { return Value ? getTrue() : getFalse();}
/// This method is provided mostly for compatibility with the other
/// ConstantIntegral subclasses.
@@ -139,7 +141,9 @@
/// Returns the opposite value of this ConstantBool value.
/// @brief Get inverse value.
- inline ConstantBool *inverted() const { return (this==True) ? False : True; }
+ inline ConstantBool *inverted() const {
+ return getValue() ? getFalse() : getTrue();
+ }
/// @returns the value of this ConstantBool
/// @brief return the boolean value of this constant.
@@ -147,10 +151,10 @@
/// @see ConstantIntegral for details
/// @brief Implement overrides
- virtual bool isNullValue() const { return this == False; }
- virtual bool isMaxValue() const { return this == True; }
- virtual bool isMinValue() const { return this == False; }
- virtual bool isAllOnesValue() const { return this == True; }
+ virtual bool isNullValue() const { return getValue() == false; }
+ virtual bool isMaxValue() const { return getValue() == true; }
+ virtual bool isMinValue() const { return getValue() == false; }
+ virtual bool isAllOnesValue() const { return getValue() == true; }
/// @brief Methods to support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantBool *) { return true; }
More information about the llvm-commits
mailing list