diff options
author | Mikael Nilsson <mikael.nilsson@arm.com> | 2018-12-13 10:15:27 +0000 |
---|---|---|
committer | Mikael Nilsson <mikael.nilsson@arm.com> | 2018-12-13 10:15:27 +0000 |
commit | 9d2872db7495d35fbc8606d7c5bdf05b7c18f750 (patch) | |
tree | 59bc6a940ee26d236aba1b6633b0e4e8590fcab0 /clang/lib/Sema/SemaDecl.cpp | |
parent | ce86b919da2fcf50829fe14201d12ab5bea70343 (diff) | |
download | bcm5719-llvm-9d2872db7495d35fbc8606d7c5bdf05b7c18f750.tar.gz bcm5719-llvm-9d2872db7495d35fbc8606d7c5bdf05b7c18f750.zip |
[OpenCL] Add generic AS to 'this' pointer
Address spaces are cast into generic before invoking the constructor.
Added support for a trailing Qualifiers object in FunctionProtoType.
Note: This recommits the previously reverted patch,
but now it is commited together with a fix for lldb.
Differential Revision: https://reviews.llvm.org/D54862
llvm-svn: 349019
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index ba7bcda0f8e..6dab332f4fb 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -3192,7 +3192,12 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, if (RequiresAdjustment) { const FunctionType *AdjustedType = New->getType()->getAs<FunctionType>(); AdjustedType = Context.adjustFunctionType(AdjustedType, NewTypeInfo); - New->setType(QualType(AdjustedType, 0)); + + QualType AdjustedQT = QualType(AdjustedType, 0); + LangAS AS = Old->getType().getAddressSpace(); + AdjustedQT = Context.getAddrSpaceQualType(AdjustedQT, AS); + + New->setType(AdjustedQT); NewQType = Context.getCanonicalType(New->getType()); NewType = cast<FunctionType>(NewQType); } @@ -10017,7 +10022,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(NewFD); if (!getLangOpts().CPlusPlus14 && MD && MD->isConstexpr() && !MD->isStatic() && !isa<CXXConstructorDecl>(MD) && - (MD->getTypeQualifiers() & Qualifiers::Const) == 0) { + !MD->getTypeQualifiers().hasConst()) { CXXMethodDecl *OldMD = nullptr; if (OldDecl) OldMD = dyn_cast_or_null<CXXMethodDecl>(OldDecl->getAsFunction()); @@ -10025,7 +10030,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, const FunctionProtoType *FPT = MD->getType()->castAs<FunctionProtoType>(); FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); - EPI.TypeQuals |= Qualifiers::Const; + EPI.TypeQuals.addConst(); MD->setType(Context.getFunctionType(FPT->getReturnType(), FPT->getParamTypes(), EPI)); |