reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

References

tools/clang/lib/AST/ExprClassification.cpp
   26 static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E);
   27 static Cl::Kinds ClassifyDecl(ASTContext &Ctx, const Decl *D);
   28 static Cl::Kinds ClassifyUnnamed(ASTContext &Ctx, QualType T);
   29 static Cl::Kinds ClassifyMemberExpr(ASTContext &Ctx, const MemberExpr *E);
   30 static Cl::Kinds ClassifyBinaryOp(ASTContext &Ctx, const BinaryOperator *E);
   31 static Cl::Kinds ClassifyConditional(ASTContext &Ctx,
   34 static Cl::ModifiableType IsModifiable(ASTContext &Ctx, const Expr *E,
   35                                        Cl::Kinds Kind, SourceLocation &Loc);
   37 Cl Expr::ClassifyImpl(ASTContext &Ctx, SourceLocation *Loc) const {
   40   Cl::Kinds kind = ClassifyInternal(Ctx, this);
   46       kind = Cl::CL_Function;
   51       kind = (kind == Cl::CL_LValue ? Cl::CL_AddressableVoid : Cl::CL_Void);
   51       kind = (kind == Cl::CL_LValue ? Cl::CL_AddressableVoid : Cl::CL_Void);
   51       kind = (kind == Cl::CL_LValue ? Cl::CL_AddressableVoid : Cl::CL_Void);
   56   case Cl::CL_LValue: assert(getValueKind() == VK_LValue); break;
   57   case Cl::CL_XValue: assert(getValueKind() == VK_XValue); break;
   58   case Cl::CL_Function:
   59   case Cl::CL_Void:
   60   case Cl::CL_AddressableVoid:
   61   case Cl::CL_DuplicateVectorComponents:
   62   case Cl::CL_MemberFunction:
   63   case Cl::CL_SubObjCPropertySetting:
   64   case Cl::CL_ClassTemporary:
   65   case Cl::CL_ArrayTemporary:
   66   case Cl::CL_ObjCMessageRValue:
   67   case Cl::CL_PRValue: assert(getValueKind() == VK_RValue); break;
   70   Cl::ModifiableType modifiable = Cl::CM_Untested;
   70   Cl::ModifiableType modifiable = Cl::CM_Untested;
   77 static Cl::Kinds ClassifyTemporary(QualType T) {
   79     return Cl::CL_ClassTemporary;
   81     return Cl::CL_ArrayTemporary;
   85   return Cl::CL_PRValue;
   88 static Cl::Kinds ClassifyExprValueKind(const LangOptions &Lang,
   93     return Lang.CPlusPlus ? ClassifyTemporary(E->getType()) : Cl::CL_PRValue;
   95     return Cl::CL_LValue;
   97     return Cl::CL_XValue;
  102 static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) {
  142     return Cl::CL_LValue;
  147     return !E->isLValue() ? ClassifyTemporary(E->getType()) : Cl::CL_LValue;
  196     return Cl::CL_PRValue;
  220     return Cl::CL_LValue;
  227                ? Cl::CL_PRValue : Cl::CL_LValue;
  227                ? Cl::CL_PRValue : Cl::CL_LValue;
  240       return Cl::CL_LValue;
  251       Cl::Kinds K = ClassifyInternal(Ctx, Op);
  252       if (K != Cl::CL_LValue) return K;
  255         return Cl::CL_SubObjCPropertySetting;
  256       return Cl::CL_LValue;
  264       return Lang.CPlusPlus ? Cl::CL_LValue : Cl::CL_PRValue;
  264       return Lang.CPlusPlus ? Cl::CL_LValue : Cl::CL_PRValue;
  267       return Cl::CL_PRValue;
  293       return Cl::CL_PRValue;
  301     return Cl::CL_PRValue;
  322       return Cl::CL_DuplicateVectorComponents;
  324       return Cl::CL_LValue;
  353     if (!Lang.CPlusPlus) return Cl::CL_PRValue;
  361     if (!Lang.CPlusPlus) return Cl::CL_PRValue;
  368     if (!Lang.CPlusPlus) return Cl::CL_PRValue;
  378       Cl::Kinds kind = ClassifyUnnamed(Ctx, Method->getReturnType());
  379       return (kind == Cl::CL_PRValue) ? Cl::CL_ObjCMessageRValue : kind;
  379       return (kind == Cl::CL_PRValue) ? Cl::CL_ObjCMessageRValue : kind;
  381     return Cl::CL_PRValue;
  389     return Cl::CL_ClassTemporary;
  401     return Cl::CL_PRValue;
  405     return Cl::CL_LValue;
  412               ? Cl::CL_LValue
  413               : Cl::CL_XValue;
  436 static Cl::Kinds ClassifyDecl(ASTContext &Ctx, const Decl *D) {
  445     return Cl::CL_MemberFunction;
  458   return islvalue ? Cl::CL_LValue : Cl::CL_PRValue;
  458   return islvalue ? Cl::CL_LValue : Cl::CL_PRValue;
  464 static Cl::Kinds ClassifyUnnamed(ASTContext &Ctx, QualType T) {
  466   if (!Ctx.getLangOpts().CPlusPlus) return Cl::CL_PRValue;
  473     return Cl::CL_LValue;
  478   return RV->getPointeeType()->isFunctionType() ? Cl::CL_LValue : Cl::CL_XValue;
  478   return RV->getPointeeType()->isFunctionType() ? Cl::CL_LValue : Cl::CL_XValue;
  481 static Cl::Kinds ClassifyMemberExpr(ASTContext &Ctx, const MemberExpr *E) {
  484               ? Cl::CL_PRValue : Cl::CL_LValue);
  484               ? Cl::CL_PRValue : Cl::CL_LValue);
  492       return Cl::CL_LValue;
  496       return Cl::CL_SubObjCPropertySetting;
  506       return Cl::CL_LValue;
  511     return Cl::CL_LValue;
  519       return Cl::CL_LValue;
  522       return Cl::CL_SubObjCPropertySetting;
  531     return Method->isStatic() ? Cl::CL_LValue : Cl::CL_MemberFunction;
  531     return Method->isStatic() ? Cl::CL_LValue : Cl::CL_MemberFunction;
  535   return Cl::CL_PRValue;
  538 static Cl::Kinds ClassifyBinaryOp(ASTContext &Ctx, const BinaryOperator *E) {
  545               ? Cl::CL_PRValue : Cl::CL_LValue);
  545               ? Cl::CL_PRValue : Cl::CL_LValue);
  558              ? Cl::CL_MemberFunction
  566              ? Cl::CL_MemberFunction
  567              : Cl::CL_LValue;
  570   return Cl::CL_PRValue;
  573 static Cl::Kinds ClassifyConditional(ASTContext &Ctx, const Expr *True,
  592     return Cl::CL_PRValue;
  600   Cl::Kinds LCl = ClassifyInternal(Ctx, True),
  602   return LCl == RCl ? LCl : Cl::CL_PRValue;
  605 static Cl::ModifiableType IsModifiable(ASTContext &Ctx, const Expr *E,
  606                                        Cl::Kinds Kind, SourceLocation &Loc) {
  609   if (Kind == Cl::CL_PRValue) {
  615         return Cl::CM_LValueCast;
  619   if (Kind != Cl::CL_LValue)
  620     return Cl::CM_RValue;
  625     return Cl::CM_Function;
  632       return Cl::CM_NoSetterProperty;
  638     return Cl::CM_ConstQualified;
  641     return Cl::CM_ConstAddrSpace;
  645     return Cl::CM_ArrayType;
  648     return Cl::CM_IncompleteType;
  653       return Cl::CM_ConstQualifiedField;
  655   return Cl::CM_Modifiable;
  661   case Cl::CL_LValue: return LV_Valid;
  662   case Cl::CL_XValue: return LV_InvalidExpression;
  663   case Cl::CL_Function: return LV_NotObjectType;
  664   case Cl::CL_Void: return LV_InvalidExpression;
  665   case Cl::CL_AddressableVoid: return LV_IncompleteVoidType;
  666   case Cl::CL_DuplicateVectorComponents: return LV_DuplicateVectorComponents;
  667   case Cl::CL_MemberFunction: return LV_MemberFunction;
  668   case Cl::CL_SubObjCPropertySetting: return LV_SubObjCPropertySetting;
  669   case Cl::CL_ClassTemporary: return LV_ClassTemporary;
  670   case Cl::CL_ArrayTemporary: return LV_ArrayTemporary;
  671   case Cl::CL_ObjCMessageRValue: return LV_InvalidMessageExpression;
  672   case Cl::CL_PRValue: return LV_InvalidExpression;
  682   case Cl::CL_LValue: break;
  683   case Cl::CL_XValue: return MLV_InvalidExpression;
  684   case Cl::CL_Function: return MLV_NotObjectType;
  685   case Cl::CL_Void: return MLV_InvalidExpression;
  686   case Cl::CL_AddressableVoid: return MLV_IncompleteVoidType;
  687   case Cl::CL_DuplicateVectorComponents: return MLV_DuplicateVectorComponents;
  688   case Cl::CL_MemberFunction: return MLV_MemberFunction;
  689   case Cl::CL_SubObjCPropertySetting: return MLV_SubObjCPropertySetting;
  690   case Cl::CL_ClassTemporary: return MLV_ClassTemporary;
  691   case Cl::CL_ArrayTemporary: return MLV_ArrayTemporary;
  692   case Cl::CL_ObjCMessageRValue: return MLV_InvalidMessageExpression;
  693   case Cl::CL_PRValue:
  694     return VC.getModifiable() == Cl::CM_LValueCast ?
  699   case Cl::CM_Untested: llvm_unreachable("Did not test modifiability");
  700   case Cl::CM_Modifiable: return MLV_Valid;
  701   case Cl::CM_RValue: llvm_unreachable("CM_RValue and CL_LValue don't match");
  702   case Cl::CM_Function: return MLV_NotObjectType;
  703   case Cl::CM_LValueCast:
  705   case Cl::CM_NoSetterProperty: return MLV_NoSetterProperty;
  706   case Cl::CM_ConstQualified: return MLV_ConstQualified;
  707   case Cl::CM_ConstQualifiedField: return MLV_ConstQualifiedField;
  708   case Cl::CM_ConstAddrSpace: return MLV_ConstAddrSpace;
  709   case Cl::CM_ArrayType: return MLV_ArrayType;
  710   case Cl::CM_IncompleteType: return MLV_IncompleteType;