diff options
author | Sam McCall <sam.mccall@gmail.com> | 2022-02-26 17:35:01 +0300 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2022-02-26 17:45:59 +0300 |
commit | 671eab254a7fc912857b697d5b6e414b71b75a60 (patch) | |
tree | 4431b2c6acfc0697a27fdea479970be4026c05d5 /clang-tools-extra | |
parent | 8dcb5e6bf584f9b7d398e6a668594e40502588f6 (diff) |
[clangd] Support IncludeFixer or base specifiers
Diffstat (limited to 'clang-tools-extra')
-rw-r--r-- | clang-tools-extra/clangd/IncludeFixer.cpp | 3 | ||||
-rw-r--r-- | clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/IncludeFixer.cpp b/clang-tools-extra/clangd/IncludeFixer.cpp index 7994e5f49920..66e955270914 100644 --- a/clang-tools-extra/clangd/IncludeFixer.cpp +++ b/clang-tools-extra/clangd/IncludeFixer.cpp @@ -20,6 +20,7 @@ #include "clang/AST/NestedNameSpecifier.h" #include "clang/AST/Type.h" #include "clang/Basic/Diagnostic.h" +#include "clang/Basic/DiagnosticParse.h" #include "clang/Basic/DiagnosticSema.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/SourceLocation.h" @@ -182,6 +183,8 @@ std::vector<Fix> IncludeFixer::fix(DiagnosticsEngine::Level DiagLevel, case diag::err_unknown_typename: case diag::err_unknown_typename_suggest: + case diag::err_unknown_type_or_class_name_suggest: + case diag::err_expected_class_name: case diag::err_typename_nested_not_found: case diag::err_no_template: case diag::err_no_template_suggest: diff --git a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp index 7de3746d2251..7fd7babe68a7 100644 --- a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp +++ b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp @@ -1044,6 +1044,7 @@ void foo() { // considered the unresolved type. $unqualified2[[X]]::Nested n; } +struct S : $base[[X]] {}; } void bar() { ns::$qualified1[[X]] x; // ns:: is valid. @@ -1087,7 +1088,11 @@ using Type = ns::$template[[Foo]]<int>; "no template named 'Foo' in namespace 'ns'"), diagName("no_member_template"), withFix(Fix(Test.range("insert"), "#include \"foo.h\"\n", - "Include \"foo.h\" for symbol ns::Foo"))))); + "Include \"foo.h\" for symbol ns::Foo"))), + AllOf(Diag(Test.range("base"), "expected class name"), + diagName("expected_class_name"), + withFix(Fix(Test.range("insert"), "#include \"x.h\"\n", + "Include \"x.h\" for symbol ns::X"))))); } TEST(IncludeFixerTest, MultipleMatchedSymbols) { |