// FIXME: Handle address spaces
unsigned MyQuals = this->getCVRQualifiers();
unsigned OtherQuals = Other.getCVRQualifiers();
+ assert(this->getAddressSpace() == 0 && "Address space not checked");
+ assert(Other.getAddressSpace() == 0 && "Address space not checked");
return MyQuals != OtherQuals && (MyQuals | OtherQuals) == MyQuals;
}
// FIXME: Handle address spaces
unsigned MyQuals = this->getCVRQualifiers();
unsigned OtherQuals = Other.getCVRQualifiers();
+ assert(this->getAddressSpace() == 0 && "Address space not checked");
+ assert(Other.getAddressSpace() == 0 && "Address space not checked");
return (MyQuals | OtherQuals) == MyQuals;
}
}
}
+/// DeclCanBeLvalue - Determine whether the given declaration can be
+/// an lvalue. This is a helper routine for isLvalue.
+static bool DeclCanBeLvalue(const NamedDecl *Decl, ASTContext &Ctx) {
+ return isa<VarDecl>(Decl) ||
+ // C++ 3.10p2: An lvalue refers to an object or function.
+ (Ctx.getLangOptions().CPlusPlus &&
+ (isa<FunctionDecl>(Decl) || isa<OverloadedFunctionDecl>(Decl)));
+}
+
/// isLvalue - C99 6.3.2.1: an lvalue is an expression with an object type or an
/// incomplete type other than void. Nonarray expressions that can be lvalues:
/// - name, where name must be a variable
return cast<ArraySubscriptExpr>(this)->getBase()->isLvalue(Ctx);
return LV_Valid;
case DeclRefExprClass: { // C99 6.5.1p2
- const Decl *RefdDecl = cast<DeclRefExpr>(this)->getDecl();
- if (isa<VarDecl>(RefdDecl) ||
- isa<ImplicitParamDecl>(RefdDecl) ||
- // C++ 3.10p2: An lvalue refers to an object or function.
- isa<FunctionDecl>(RefdDecl) ||
- isa<OverloadedFunctionDecl>(RefdDecl))
+ const NamedDecl *RefdDecl = cast<DeclRefExpr>(this)->getDecl();
+ if (DeclCanBeLvalue(RefdDecl, Ctx))
return LV_Valid;
break;
}
Sema::CompareQualificationConversions(const StandardConversionSequence& SCS1,
const StandardConversionSequence& SCS2)
{
+ // C++ 13.3.3.2p3:
// -- S1 and S2 differ only in their qualification conversion and
// yield similar types T1 and T2 (C++ 4.4), respectively, and the
// cv-qualification signature of type T1 is a proper subset of