[cfe-commits] r83134 - /cfe/trunk/lib/Sema/SemaExprCXX.cpp

Chris Lattner clattner at apple.com
Tue Sep 29 18:33:57 PDT 2009


On Sep 29, 2009, at 6:30 PM, John McCall wrote:

> Author: rjmccall
> Date: Tue Sep 29 20:30:54 2009
> New Revision: 83134
>
> URL: http://llvm.org/viewvc/llvm-project?rev=83134&view=rev
> Log:
> Spare the processors of those poor wretches who have no choice but  
> to write
> unbounded chains of operator-> delegations.

Yay, :)  You can also use .getTypePtr() with SmallPtrSet<const Type*, 
8> if it makes ya feel better :)

Thanks John,

-Chris

>
>
> Modified:
>    cfe/trunk/lib/Sema/SemaExprCXX.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=83134&r1=83133&r2=83134&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Tue Sep 29 20:30:54 2009
> @@ -1978,8 +1978,8 @@
>   //   returned, with the original second operand.
>   if (OpKind == tok::arrow) {
>     // The set of types we've considered so far.
> -    llvm::SmallVector<CanQualType,8> CTypes;
> -    CTypes.push_back(Context.getCanonicalType(BaseType));
> +    llvm::SmallPtrSet<CanQualType,8> CTypes;
> +    CTypes.insert(Context.getCanonicalType(BaseType));
>
>     while (BaseType->isRecordType()) {
>       Base = BuildOverloadedArrowExpr(S, move(Base), BaseExpr- 
> >getExprLoc());
> @@ -1988,12 +1988,11 @@
>         return ExprError();
>       BaseType = BaseExpr->getType();
>       CanQualType CBaseType = Context.getCanonicalType(BaseType);
> -      if (std::find(CTypes.begin(), CTypes.end(), CBaseType) !=  
> CTypes.end()) {
> +      if (!CTypes.insert(CBaseType)) {
>         // TODO: note the chain of conversions
>         Diag(OpLoc, diag::err_operator_arrow_circular);
>         return ExprError();
>       }
> -      CTypes.push_back(CBaseType);
>     }
>   }
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list