-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Resolve FIXME: Look at E, not M #85541
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-clang Author: AtariDreams (AtariDreams) ChangesFull diff: https://github.com/llvm/llvm-project/pull/85541.diff 1 Files Affected:
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 59a7fe8925001c..c826663955fecf 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -273,9 +273,7 @@ pushTemporaryCleanup(CodeGenFunction &CGF, const MaterializeTemporaryExpr *M,
// Objective-C++ ARC:
// If we are binding a reference to a temporary that has ownership, we
// need to perform retain/release operations on the temporary.
- //
- // FIXME: This should be looking at E, not M.
- if (auto Lifetime = M->getType().getObjCLifetime()) {
+ if (auto Lifetime = E->getType().getObjCLifetime()) {
switch (Lifetime) {
case Qualifiers::OCL_None:
case Qualifiers::OCL_ExplicitNone:
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
369cd6f
to
214a252
Compare
Well, sometimes we do leave FIXMEs that end up being suprisingly easy to fix. But what FIXME are we talking about here? The patch doesn't remove any FIXMEs, or for that matter include any tests. |
llvm-project/clang/lib/CodeGen/CGExpr.cpp Line 277 in c0f8be4
|
Hmm. Well, you'd have to ask @zygoloid what he was thinking in r183721/r183859, but I don't think it's correct in general to be looking at E (the MTE sub-expression) for most of the logic here. IIRC, the MTE sub-expression is essentially the initializer for the materialized temporary, so it should be a pr-value, which means that for ARC (and any similar features in the future that we might add with qualifier-specific ownership) it won't have the right type information to set up the destructor for the temporary. That is, |
IIRC the issue here is that in C++98, the MTE is in a "weird" place in the AST, because of the different rules governing how and when temporaries are formed. For example, for So I think the idea is that (That's mostly from memory, I might have got some details wrong.) |
Hmm. The best solution there is probably to use a consistent representation but introduce some sort of |
No description provided.