[llvm-commits] [llvm] r49642 - /llvm/branches/ggreif/use-diet/include/llvm/OperandTraits.h
Gabor Greif
ggreif at gmail.com
Mon Apr 14 06:10:23 PDT 2008
Author: ggreif
Date: Mon Apr 14 08:10:21 2008
New Revision: 49642
URL: http://llvm.org/viewvc/llvm-project?rev=49642&view=rev
Log:
when expanding Op<> member template, make it less probable that name capture occurs. C++ compilers should warn on this!
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=49642&r1=49641&r2=49642&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/OperandTraits.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/OperandTraits.h Mon Apr 14 08:10:21 2008
@@ -99,8 +99,8 @@
inline VALUECLASS *getOperand(unsigned) const; \
inline void setOperand(unsigned, VALUECLASS*); \
inline unsigned getNumOperands() const; \
- template <unsigned Idx> inline Use &Op(); \
- template <unsigned Idx> inline const Use &Op() const
+ template <unsigned> inline Use &Op(); \
+ template <unsigned> inline const Use &Op() const
/// Macro for generating out-of-class operand accessor definitions
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS) \
@@ -113,11 +113,11 @@
OperandTraits<CLASS>::op_begin(this)[i] = Val; \
} \
unsigned CLASS::getNumOperands() const { return OperandTraits<CLASS>::operands(this); } \
-template <unsigned Idx> Use &CLASS::Op() { \
- return OperandTraits<CLASS>::op_begin(this)[Idx]; \
+template <unsigned Idx_nocapture> Use &CLASS::Op() { \
+ return OperandTraits<CLASS>::op_begin(this)[Idx_nocapture]; \
} \
-template <unsigned Idx> const Use &CLASS::Op() const { \
- return OperandTraits<CLASS>::op_begin(const_cast<CLASS*>(this))[Idx]; \
+template <unsigned Idx_nocapture> const Use &CLASS::Op() const { \
+ return OperandTraits<CLASS>::op_begin(const_cast<CLASS*>(this))[Idx_nocapture]; \
}
@@ -133,11 +133,11 @@
OperandTraits<CLASS>::op_begin(this)[i] = Val; \
} \
unsigned CLASS::getNumOperands() const { return OperandTraits<CLASS>::operands(this); } \
-template <unsigned Idx> Use &CLASS::Op() { \
- return OperandTraits<CLASS>::op_begin(this)[Idx]; \
+template <unsigned Idx_nocapture> Use &CLASS::Op() { \
+ return OperandTraits<CLASS>::op_begin(this)[Idx_nocapture]; \
} \
-template <unsigned Idx> const Use &CLASS::Op() const { \
- return OperandTraits<CLASS>::op_begin(const_cast<CLASS*>(this))[Idx]; \
+template <unsigned Idx_nocapture> const Use &CLASS::Op() const { \
+ return OperandTraits<CLASS>::op_begin(const_cast<CLASS*>(this))[Idx_nocapture]; \
}
More information about the llvm-commits
mailing list