[cfe-commits] r83603 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/Sema.h lib/Sema/SemaOverload.cpp

John McCall rjmccall at apple.com
Thu Oct 8 18:34:09 PDT 2009


Fariborz Jahanian wrote:
> Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=83603&r1=83602&r2=83603&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu Oct  8 19:13:15 2009
> @@ -3690,11 +3690,12 @@
>             Ptr != CandidateTypes.pointer_end(); ++Ptr) {
>          QualType C1Ty = (*Ptr);
>          QualType C1;
> +        unsigned CV1;
>          if (const PointerType *PointerTy = C1Ty->getAs<PointerType>()) {
> -          C1 = PointerTy->getPointeeType();
> -          C1 = C1.getUnqualifiedType();
> +          C1 = PointerTy->getPointeeType().getUnqualifiedType();
>            if (!isa<RecordType>(C1))
>              continue;
> +          CV1 = PointerTy->getPointeeType().getCVRQualifiers();
>          }
>          for (BuiltinCandidateTypeSet::iterator
>               MemPtr = CandidateTypes.member_pointer_begin(),
> @@ -3708,7 +3709,6 @@
>            QualType ParamTypes[2] = { *Ptr, *MemPtr };
>            // build CV12 T&
>            QualType T = mptr->getPointeeType();
> -          unsigned CV1 = (*Ptr).getCVRQualifiers();
>            unsigned CV2 = T.getCVRQualifiers();
>            T = Context.getCVRQualifiedType(T, (CV1 | CV2));
>            QualType ResultTy = Context.getLValueReferenceType(T);
>   

This shouldn't be too hard to make extqual-safe.  Neither the base 
pointer nor the member pointer can be ObjC-GC-qualified, and TR18037 
says that the address space of a member is the the address space of the 
base.  The qualifiers in CV2 are even already incorporated in T, so it 
really just comes down to:

  const Type *C1;
  QualifierCollector Q1;
  if (...) {
    C1 = Q1.strip(PointerTy->getPointeeType());
    ...
  }
  ...
    T = Q1.apply(T);

John.



More information about the cfe-commits mailing list