[clang] [clang][AST] Fix crash on labeled break/continue within switch condition statement expression (PR #228655)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 6 04:39:02 PDT 2026
Expertcoderz wrote:
> I’d go with std::optional<Stmt *> if we want to do that, along w/ a comment that explains the three possible states are (1. not labelled, 2. labelled, but the LabelDecl doesn’t exist yet, 3. labelled and it does exist).
(commenting here since github marked the review as outdated)
That should be a good compromise between keeping the interface simple and preventing people from assuming that it will always return a non-null pointer. I've switched `getNamedLoopIOrSwitch()` over to using `const std::optional<Stmt *>` as its return type.
https://github.com/llvm/llvm-project/pull/228655
More information about the cfe-commits
mailing list