forked from OSchip/llvm-project
[clangd] PopulateSwitch: disable on dependent enums.
If the enum is a dependent type, we would crash somewhere in getIntWidth(). -Wswitch diagnostic doesn't work on dependent enums either. Differential Revision: https://reviews.llvm.org/D92051
This commit is contained in:
parent
1ba4b82f67
commit
f6970503d2
|
@ -126,7 +126,7 @@ bool PopulateSwitch::prepare(const Selection &Sel) {
|
|||
return false;
|
||||
|
||||
EnumD = EnumT->getDecl();
|
||||
if (!EnumD)
|
||||
if (!EnumD || EnumD->isDependentType())
|
||||
return false;
|
||||
|
||||
// We trigger if there are any values in the enum that aren't covered by the
|
||||
|
|
|
@ -3084,6 +3084,12 @@ TEST_F(PopulateSwitchTest, Test) {
|
|||
R""(enum Enum {A,B,b=B}; ^switch (A) {case A:case B:break;})"",
|
||||
"unavailable",
|
||||
},
|
||||
{
|
||||
// Enum is dependent type
|
||||
File,
|
||||
R""(template<typename T> void f() {enum Enum {A}; ^switch (A) {}})"",
|
||||
"unavailable",
|
||||
},
|
||||
};
|
||||
|
||||
for (const auto &Case : Cases) {
|
||||
|
|
Loading…
Reference in New Issue