-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[clang] Non-object types are non-trivially relocatable #69734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang] Non-object types are non-trivially relocatable #69734
Conversation
@llvm/pr-subscribers-clang Author: Amirreza Ashouri (AMP999) ChangesBoth active C++ proposals (P1144 and P2786) agree that Fixes #67498 Full diff: https://github.com/llvm/llvm-project/pull/69734.diff 1 Files Affected:
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 8389b1423058197..bdeff1e4ac5b604 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -2649,6 +2649,8 @@ bool QualType::isTriviallyRelocatableType(const ASTContext &Context) const {
if (BaseElementType->isIncompleteType()) {
return false;
+ } else if (!BaseElementType->isObjectType()) {
+ return false;
} else if (const auto *RD = BaseElementType->getAsRecordDecl()) {
return RD->canPassInRegisters();
} else {
|
Can you add tests / release notes? (the change itself looks fine to me) |
6433528
to
a67c7b8
Compare
@cor3ntin Are these tests what you had in mind? Are they sufficient? What else should I add? |
@cor3ntin Gentle ping! |
@AMP999 Sorry, I'm in a committee meeting this week. tests look good. it's still missing a release note though |
Thank you! No problem! I'll add the release notes. |
a67c7b8
to
ffc19dd
Compare
ffc19dd
to
187bfbf
Compare
187bfbf
to
befa993
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
You're welcome! |
@cor3ntin Could you land this for me, please? |
@AMP999 can you resolve the conflict? |
Oh, Sure. I didn't notice that. |
befa993
to
a0b9798
Compare
Both active C++ proposals (P1144 and P2786) agree that `is_trivially_relocatable_v<int&>` and `is_trivially_relocatable_v<int()>` should be false, not true. Only complete object types can be trivially relocatable. Fixes llvm#67498
a0b9798
to
8cad094
Compare
@cor3ntin I've fixed that. |
Both active C++ proposals (P1144 and P2786) agree that
is_trivially_relocatable_v<int&>
andis_trivially_relocatable_v<int()>
should be false, not true. Only complete object types can be trivially relocatable.Fixes #67498