/// class, and can be distinguished via \c getReceiverKind(). Example:
///
class ObjCMessageExpr : public Expr {
+ enum { NumArgsBitWidth = 16 };
+
/// \brief The number of arguments in the message send, not
/// including the receiver.
- unsigned NumArgs : 16;
+ unsigned NumArgs : NumArgsBitWidth;
+
+ void setNumArgs(unsigned Num) {
+ assert((Num >> NumArgsBitWidth) == 0 && "Num of args is out of range!");
+ NumArgs = Num;
+ }
/// \brief The kind of message send this is, which is one of the
/// ReceiverKind values.
SourceLocation LBracLoc, RBracLoc;
ObjCMessageExpr(EmptyShell Empty, unsigned NumArgs)
- : Expr(ObjCMessageExprClass, Empty), NumArgs(NumArgs), Kind(0),
- HasMethod(0), IsDelegateInitCall(0), SelectorOrMethod(0) { }
+ : Expr(ObjCMessageExprClass, Empty), Kind(0),
+ HasMethod(0), IsDelegateInitCall(0), SelectorOrMethod(0) {
+ setNumArgs(NumArgs);
+ }
ObjCMessageExpr(QualType T, ExprValueKind VK,
SourceLocation LBracLoc,
/*TypeDependent=*/false, /*ValueDependent=*/false,
/*InstantiationDependent=*/false,
/*ContainsUnexpandedParameterPack=*/false),
- NumArgs(NumArgs), Kind(IsInstanceSuper? SuperInstance : SuperClass),
+ Kind(IsInstanceSuper? SuperInstance : SuperClass),
HasMethod(Method != 0), IsDelegateInitCall(false), SuperLoc(SuperLoc),
SelectorOrMethod(reinterpret_cast<uintptr_t>(Method? Method
: Sel.getAsOpaquePtr())),
SelectorLoc(SelLoc), LBracLoc(LBracLoc), RBracLoc(RBracLoc)
{
+ setNumArgs(NumArgs);
setReceiverPointer(SuperType.getAsOpaquePtr());
if (NumArgs)
memcpy(getArgs(), Args, NumArgs * sizeof(Expr *));
: Expr(ObjCMessageExprClass, T, VK, OK_Ordinary, T->isDependentType(),
T->isDependentType(), T->isInstantiationDependentType(),
T->containsUnexpandedParameterPack()),
- NumArgs(NumArgs), Kind(Class),
+ Kind(Class),
HasMethod(Method != 0), IsDelegateInitCall(false),
SelectorOrMethod(reinterpret_cast<uintptr_t>(Method? Method
: Sel.getAsOpaquePtr())),
SelectorLoc(SelLoc), LBracLoc(LBracLoc), RBracLoc(RBracLoc)
{
+ setNumArgs(NumArgs);
setReceiverPointer(Receiver);
Expr **MyArgs = getArgs();
for (unsigned I = 0; I != NumArgs; ++I) {
Receiver->isTypeDependent(),
Receiver->isInstantiationDependent(),
Receiver->containsUnexpandedParameterPack()),
- NumArgs(NumArgs), Kind(Instance),
+ Kind(Instance),
HasMethod(Method != 0), IsDelegateInitCall(false),
SelectorOrMethod(reinterpret_cast<uintptr_t>(Method? Method
: Sel.getAsOpaquePtr())),
SelectorLoc(SelLoc), LBracLoc(LBracLoc), RBracLoc(RBracLoc)
{
+ setNumArgs(NumArgs);
setReceiverPointer(Receiver);
Expr **MyArgs = getArgs();
for (unsigned I = 0; I != NumArgs; ++I) {