[clang] 438cf55 - [OpenCL] Fix missing addrspace on implicit move assignment operator
Ole Strohm via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 7 02:04:27 PDT 2021
Author: Ole Strohm
Date: 2021-06-07T09:37:53+01:00
New Revision: 438cf5577e720f84d493a272c5a1cbaf6ce19e51
URL: https://github.com/llvm/llvm-project/commit/438cf5577e720f84d493a272c5a1cbaf6ce19e51
DIFF: https://github.com/llvm/llvm-project/commit/438cf5577e720f84d493a272c5a1cbaf6ce19e51.diff
LOG: [OpenCL] Fix missing addrspace on implicit move assignment operator
This fixes the missing address space on `this` in the implicit move
assignment operator.
The function called here is an abstraction around the lines that have
been removed which also sets the address space correctly.
This is copied from CopyConstructor, CopyAssignment and MoveConstructor,
all of which use this function, and now MoveAssignment does too.
Fixes: PR50259
Reviewed By: svenvh
Differential Revision: https://reviews.llvm.org/D103252
Added:
clang/test/AST/ast-dump-implicit-members.clcpp
Modified:
clang/lib/Sema/SemaDeclCXX.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index f6c907b2f98a1..3fffcd33ac50f 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -14344,10 +14344,7 @@ CXXMethodDecl *Sema::DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl) {
/* Diagnose */ false);
}
- // Build an exception specification pointing back at this member.
- FunctionProtoType::ExtProtoInfo EPI =
- getImplicitMethodEPI(*this, MoveAssignment);
- MoveAssignment->setType(Context.getFunctionType(RetType, ArgType, EPI));
+ setupImplicitSpecialMemberType(MoveAssignment, RetType, ArgType);
// Add the parameter to the operator.
ParmVarDecl *FromParam = ParmVarDecl::Create(Context, MoveAssignment,
diff --git a/clang/test/AST/ast-dump-implicit-members.clcpp b/clang/test/AST/ast-dump-implicit-members.clcpp
new file mode 100644
index 0000000000000..5e1eb7c48c2a9
--- /dev/null
+++ b/clang/test/AST/ast-dump-implicit-members.clcpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -ast-dump -ast-dump-filter S | FileCheck -strict-whitespace %s
+
+struct S {};
+
+void f() {
+ S i;
+ i = i;
+}
+
+// CHECK: CXXConstructorDecl {{.*}} implicit used constexpr S 'void () __generic noexcept'
+// CHECK: CXXConstructorDecl {{.*}} implicit constexpr S 'void (const __generic S &) __generic'
+// CHECK: CXXConstructorDecl {{.*}} implicit constexpr S 'void (__generic S &&) __generic'
+// CHECK: CXXMethodDecl {{.*}} implicit used constexpr operator= '__generic S &(const __generic S &) __generic noexcept'
+// CHECK: CXXMethodDecl {{.*}} implicit constexpr operator= '__generic S &(__generic S &&) __generic'
More information about the cfe-commits
mailing list