[llvm-commits] CVS: llvm/include/llvm/Constants.h
Reid Spencer
reid at x10sys.com
Thu Mar 1 13:50:58 PST 2007
Changes in directory llvm/include/llvm:
Constants.h updated: 1.135 -> 1.136
---
Log message:
Add an isUnitValue method for comparison against 1. This just follows a
common pattern with isNullValue, isAllOnesValue, etc. It also helps to
prevent things like getZExtValue() == 1, which could assert for large
bitwidths.
---
Diffs of the changes: (+7 -0)
Constants.h | 7 +++++++
1 files changed, 7 insertions(+)
Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.135 llvm/include/llvm/Constants.h:1.136
--- llvm/include/llvm/Constants.h:1.135 Thu Mar 1 13:30:07 2007
+++ llvm/include/llvm/Constants.h Thu Mar 1 15:50:41 2007
@@ -127,6 +127,13 @@
return Val == 0;
}
+ /// This is just a convenience method to make client code smaller for a
+ /// common case.
+ /// @brief Determine if the value is one.
+ virtual bool isUnitValue() const {
+ return Val == 1;
+ }
+
/// This function will return true iff every bit in this constant is set
/// to true.
/// @returns true iff this constant's bits are all set to true.
More information about the llvm-commits
mailing list