-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang][Interp] Cleaning up FIXME
s added during ArrayInitLoopExpr
implementation.
#70053
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -360,6 +360,7 @@ template <class Emitter> class LocalScope : public VariableScope<Emitter> { | |
if (!Idx) | ||
return; | ||
this->Ctx->emitDestroy(*Idx, SourceInfo{}); | ||
removeStoredOpaqueValues(); | ||
} | ||
|
||
/// Overriden to support explicit destruction. | ||
|
@@ -368,6 +369,7 @@ template <class Emitter> class LocalScope : public VariableScope<Emitter> { | |
return; | ||
this->emitDestructors(); | ||
this->Ctx->emitDestroy(*Idx, SourceInfo{}); | ||
removeStoredOpaqueValues(); | ||
isuckatcs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this->Idx = std::nullopt; | ||
} | ||
|
||
|
@@ -389,10 +391,29 @@ template <class Emitter> class LocalScope : public VariableScope<Emitter> { | |
if (!Local.Desc->isPrimitive() && !Local.Desc->isPrimitiveArray()) { | ||
this->Ctx->emitGetPtrLocal(Local.Offset, SourceInfo{}); | ||
this->Ctx->emitRecordDestruction(Local.Desc); | ||
removeIfStoredOpaqueValue(Local); | ||
} | ||
} | ||
} | ||
|
||
void removeStoredOpaqueValues() { | ||
if (!Idx) | ||
return; | ||
|
||
for (const Scope::Local &Local : this->Ctx->Descriptors[*Idx]) { | ||
removeIfStoredOpaqueValue(Local); | ||
} | ||
} | ||
|
||
void removeIfStoredOpaqueValue(const Scope::Local &Local) { | ||
if (const auto *OVE = | ||
llvm::dyn_cast_if_present<OpaqueValueExpr>(Local.Desc->asExpr())) { | ||
if (auto It = this->Ctx->OpaqueExprs.find(OVE); | ||
It != this->Ctx->OpaqueExprs.end()) | ||
this->Ctx->OpaqueExprs.erase(It); | ||
}; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is just leaving them in the map such a big deal? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There might be cases like loops or recursive functions, where we might want to evaluate the same |
||
/// Index of the scope in the chain. | ||
std::optional<unsigned> Idx; | ||
}; | ||
|
Uh oh!
There was an error while loading. Please reload this page.