[llvm-commits] [llvm] r49851 - /llvm/branches/ggreif/use-diet/include/llvm/OperandTraits.h

Gabor Greif ggreif at gmail.com
Thu Apr 17 05:53:15 PDT 2008


Author: ggreif
Date: Thu Apr 17 07:53:15 2008
New Revision: 49851

URL: http://llvm.org/viewvc/llvm-project?rev=49851&view=rev
Log:
more precautions against unintentional name capture

Modified:
    llvm/branches/ggreif/use-diet/include/llvm/OperandTraits.h

Modified: llvm/branches/ggreif/use-diet/include/llvm/OperandTraits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/OperandTraits.h?rev=49851&r1=49850&r2=49851&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/OperandTraits.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/OperandTraits.h Thu Apr 17 07:53:15 2008
@@ -104,13 +104,13 @@
 
 /// Macro for generating out-of-class operand accessor definitions
 #define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS) \
-VALUECLASS *CLASS::getOperand(unsigned i) const { \
-  assert(i < OperandTraits<CLASS>::operands(this) && "getOperand() out of range!"); \
-  return static_cast<VALUECLASS*>(OperandTraits<CLASS>::op_begin(const_cast<CLASS*>(this))[i]); \
-} \
-void CLASS::setOperand(unsigned i, VALUECLASS *Val) { \
-  assert(i < OperandTraits<CLASS>::operands(this) && "setOperand() out of range!"); \
-  OperandTraits<CLASS>::op_begin(this)[i] = Val; \
+VALUECLASS *CLASS::getOperand(unsigned i_nocapture) const { \
+  assert(i_nocapture < OperandTraits<CLASS>::operands(this) && "getOperand() out of range!"); \
+  return static_cast<VALUECLASS*>(OperandTraits<CLASS>::op_begin(const_cast<CLASS*>(this))[i_nocapture]); \
+} \
+void CLASS::setOperand(unsigned i_nocapture, VALUECLASS *Val_nocapture) { \
+  assert(i_nocapture < OperandTraits<CLASS>::operands(this) && "setOperand() out of range!"); \
+  OperandTraits<CLASS>::op_begin(this)[i_nocapture] = Val_nocapture; \
 } \
 unsigned CLASS::getNumOperands() const { return OperandTraits<CLASS>::operands(this); } \
 template <unsigned Idx_nocapture> Use &CLASS::Op() { \
@@ -124,13 +124,13 @@
 /// Macro for generating out-of-class operand accessor
 /// definitions with casted result
 #define DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(CLASS, VALUECLASS) \
-VALUECLASS *CLASS::getOperand(unsigned i) const { \
-  assert(i < OperandTraits<CLASS>::operands(this) && "getOperand() out of range!"); \
-  return cast<VALUECLASS>(OperandTraits<CLASS>::op_begin(const_cast<CLASS*>(this))[i]); \
-} \
-void CLASS::setOperand(unsigned i, VALUECLASS *Val) { \
-  assert(i < OperandTraits<CLASS>::operands(this) && "setOperand() out of range!"); \
-  OperandTraits<CLASS>::op_begin(this)[i] = Val; \
+VALUECLASS *CLASS::getOperand(unsigned i_nocapture) const { \
+  assert(i_nocapture < OperandTraits<CLASS>::operands(this) && "getOperand() out of range!"); \
+  return cast<VALUECLASS>(OperandTraits<CLASS>::op_begin(const_cast<CLASS*>(this))[i_nocapture]); \
+} \
+void CLASS::setOperand(unsigned i_nocapture, VALUECLASS *Val_nocapture) { \
+  assert(i_nocapture < OperandTraits<CLASS>::operands(this) && "setOperand() out of range!"); \
+  OperandTraits<CLASS>::op_begin(this)[i_nocapture] = Val_nocapture; \
 } \
 unsigned CLASS::getNumOperands() const { return OperandTraits<CLASS>::operands(this); } \
 template <unsigned Idx_nocapture> Use &CLASS::Op() { \





More information about the llvm-commits mailing list