diff options
author | Mikael Nilsson <mikael.nilsson@arm.com> | 2018-12-12 15:06:16 +0000 |
---|---|---|
committer | Mikael Nilsson <mikael.nilsson@arm.com> | 2018-12-12 15:06:16 +0000 |
commit | fbfddd394f19e2cc2ce853f1dad23b0d37c350c2 (patch) | |
tree | 9a619f061fbd417cdc8ef6cd34a5c8e752f57d9b /lib/Sema/SemaOverload.cpp | |
parent | 55b58df36e758826d6b27598ca37c211b8fecf8a (diff) |
Revert "[OpenCL] Add generic AS to 'this' pointer"
Reverting because the patch broke lldb.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348931 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 2c0516c03a..22514ee242 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -1142,9 +1142,8 @@ bool Sema::IsOverload(FunctionDecl *New, FunctionDecl *Old, // function yet (because we haven't yet resolved whether this is a static // or non-static member function). Add it now, on the assumption that this // is a redeclaration of OldMethod. - // FIXME: OpenCL: Need to consider address spaces - unsigned OldQuals = OldMethod->getTypeQualifiers().getCVRUQualifiers(); - unsigned NewQuals = NewMethod->getTypeQualifiers().getCVRUQualifiers(); + unsigned OldQuals = OldMethod->getTypeQualifiers(); + unsigned NewQuals = NewMethod->getTypeQualifiers(); if (!getLangOpts().CPlusPlus14 && NewMethod->isConstexpr() && !isa<CXXConstructorDecl>(NewMethod)) NewQuals |= Qualifiers::Const; @@ -2824,9 +2823,8 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, return; } - // FIXME: OpenCL: Need to consider address spaces - unsigned FromQuals = FromFunction->getTypeQuals().getCVRUQualifiers(); - unsigned ToQuals = ToFunction->getTypeQuals().getCVRUQualifiers(); + unsigned FromQuals = FromFunction->getTypeQuals(), + ToQuals = ToFunction->getTypeQuals(); if (FromQuals != ToQuals) { PDiag << ft_qualifer_mismatch << ToQuals << FromQuals; return; @@ -5067,15 +5065,9 @@ TryObjectArgumentInitialization(Sema &S, SourceLocation Loc, QualType FromType, QualType ClassType = S.Context.getTypeDeclType(ActingContext); // [class.dtor]p2: A destructor can be invoked for a const, volatile or // const volatile object. - Qualifiers Quals; - if (isa<CXXDestructorDecl>(Method)) { - Quals.addConst(); - Quals.addVolatile(); - } else { - Quals = Method->getTypeQualifiers(); - } - - QualType ImplicitParamType = S.Context.getQualifiedType(ClassType, Quals); + unsigned Quals = isa<CXXDestructorDecl>(Method) ? + Qualifiers::Const | Qualifiers::Volatile : Method->getTypeQualifiers(); + QualType ImplicitParamType = S.Context.getCVRQualifiedType(ClassType, Quals); // Set up the conversion sequence as a "bad" conversion, to allow us // to exit early. @@ -5141,7 +5133,7 @@ TryObjectArgumentInitialization(Sema &S, SourceLocation Loc, QualType FromType, break; case RQ_LValue: - if (!FromClassification.isLValue() && !Quals.hasOnlyConst()) { + if (!FromClassification.isLValue() && Quals != Qualifiers::Const) { // non-const lvalue reference cannot bind to an rvalue ICS.setBad(BadConversionSequence::lvalue_ref_to_rvalue, FromType, ImplicitParamType); @@ -5257,14 +5249,9 @@ Sema::PerformObjectArgumentInitialization(Expr *From, From = FromRes.get(); } - if (!Context.hasSameType(From->getType(), DestType)) { - if (From->getType().getAddressSpace() != DestType.getAddressSpace()) - From = ImpCastExprToType(From, DestType, CK_AddressSpaceConversion, + if (!Context.hasSameType(From->getType(), DestType)) + From = ImpCastExprToType(From, DestType, CK_NoOp, From->getValueKind()).get(); - else - From = ImpCastExprToType(From, DestType, CK_NoOp, - From->getValueKind()).get(); - } return From; } @@ -12839,7 +12826,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, // Check that the object type isn't more qualified than the // member function we're calling. - Qualifiers funcQuals = proto->getTypeQuals(); + Qualifiers funcQuals = Qualifiers::fromCVRMask(proto->getTypeQuals()); QualType objectType = op->getLHS()->getType(); if (op->getOpcode() == BO_PtrMemI) |