[PATCH] D109386: Fix use-after-free from GlobalCtors associated data

2021-09-08 Thread Lei Wang via Phabricator via cfe-commits
wlei added a comment. @rnk @rjmccall Thanks for the suggestion! @wenlei Thanks for the helpful example! Changed to use ValueHandle(WeakTrackingVH) for this, please see if this looks good to you. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D10938

[PATCH] D109386: Fix use-after-free from GlobalCtors associated data

2021-09-08 Thread Lei Wang via Phabricator via cfe-commits
wlei updated this revision to Diff 371455. wlei added a comment. change to use ValueHandle for associated data Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D109386/new/ https://reviews.llvm.org/D109386 Files: clang/lib/CodeGen/CodeGenModule.cpp

[PATCH] D109386: Fix use-after-free from GlobalCtors associated data

2021-09-08 Thread Wenlei He via Phabricator via cfe-commits
wenlei added a comment. Yes, this looks like the kind of stuff VH is designed for. @wlei here's an example of how VH is used to handle deletion of BFI of basic blocks: https://reviews.llvm.org/D75341. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D

[PATCH] D109386: Fix use-after-free from GlobalCtors associated data

2021-09-07 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. I agree with Reid. IRGen should never be holding naked references (across different invocations as an `ASTConsumer`) to a replaceable entity. There are some entities that are known not to be replaceable, but in general the associated data of a global constructor does

[PATCH] D109386: Fix use-after-free from GlobalCtors associated data

2021-09-07 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment. This seems like a good use for a ValueHandle, even if it is slightly more code. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D109386/new/ https://reviews.llvm.org/D109386 ___ cfe-com

[PATCH] D109386: Fix use-after-free from GlobalCtors associated data

2021-09-07 Thread Lei Wang via Phabricator via cfe-commits
wlei created this revision. Herald added subscribers: hoy, wenlei, lxfind. wlei requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D109386 Files: clang/lib/CodeGen/CodeGenModul