[PATCH] D134243: Don't crash when code completing `using enum ^Foo`.
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 20 06:58:40 PDT 2022
ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.
LGTM to fix the crash.
If @urnathan's changes happen to make this change obsolete, we could also revert consider reverting it afterwards.
================
Comment at: clang/lib/Parse/ParseDecl.cpp:4591
Actions.CodeCompleteTag(getCurScope(), DeclSpec::TST_enum);
+ DS.SetTypeSpecError();
return;
----------------
sammccall wrote:
> this is a bit unusual, usually parse() functions just stop after hitting CC, as if they hit something unexpected.
>
> However ParseUsingDeclaration immediately calls ActOnUsingDeclaration, which asserts that the enum specifier we parsed was one of {enum, typename, error}. It seems simpler to signal failure using the existing mechanism than add a new one - LMK what you think.
Could you add a comment mentioning that `ActOnUsingDeclaration` will break if we don't do this?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134243/new/
https://reviews.llvm.org/D134243
More information about the cfe-commits
mailing list