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 | 53945281fb63e7d22d68d6bc3f11c15d9fb49771 (patch) | |
tree | 4ec0bc6e162ae403797a47795298b1d1cdc791e9 /lib/Parse/ParseDecl.cpp | |
parent | b47c6d8a7ba79ece4c80e6dc36be94535b90a84a (diff) | |
download | clang-53945281fb63e7d22d68d6bc3f11c15d9fb49771.tar.gz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349019 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index bff91793d9..caf443de63 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -1427,7 +1427,7 @@ void Parser::ParseLexedAttribute(LateParsedAttribute &LA, RecordDecl *RD = dyn_cast_or_null<RecordDecl>(D->getDeclContext()); // Allow 'this' within late-parsed attributes. - Sema::CXXThisScopeRAII ThisScope(Actions, RD, /*TypeQuals=*/0, + Sema::CXXThisScopeRAII ThisScope(Actions, RD, Qualifiers(), ND && ND->isCXXInstanceMember()); if (LA.Decls.size() == 1) { @@ -6162,13 +6162,14 @@ void Parser::ParseFunctionDeclarator(Declarator &D, : D.getContext() == DeclaratorContext::FileContext && D.getCXXScopeSpec().isValid() && Actions.CurContext->isRecord()); - Sema::CXXThisScopeRAII ThisScope(Actions, - dyn_cast<CXXRecordDecl>(Actions.CurContext), - DS.getTypeQualifiers() | - (D.getDeclSpec().isConstexprSpecified() && - !getLangOpts().CPlusPlus14 - ? Qualifiers::Const : 0), - IsCXX11MemberFunction); + + Qualifiers Q = Qualifiers::fromCVRUMask(DS.getTypeQualifiers()); + if (D.getDeclSpec().isConstexprSpecified() && !getLangOpts().CPlusPlus14) + Q.addConst(); + + Sema::CXXThisScopeRAII ThisScope( + Actions, dyn_cast<CXXRecordDecl>(Actions.CurContext), Q, + IsCXX11MemberFunction); // Parse exception-specification[opt]. bool Delayed = D.isFirstDeclarationOfMember() && |