[llvm] [SandboxVectorizer][NFCI] Fix use of possibly-uninitialized scalar. (PR #122201)
Jorge Gorbe Moya via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 9 12:10:09 PST 2025
slackito wrote:
Nice find! I think the right place to fix this is in the `sandboxir::Context` class, so that client code doesn't have to worry about initializing the callback ID to an invalid value. Right now a CallbackID is just an integer, but it's used as an opaque ID so we could have something like:
```
class CallbackID {
uint64_t id = std::numeric_limits<uint64_t>::max();
};
```
and this way unregistering an uninitialized ID from anywhere would always trigger an assertion failure (in an asserts-enabled build), or at least not collide with any registered IDs.
What do you think?
https://github.com/llvm/llvm-project/pull/122201
More information about the llvm-commits
mailing list