[clang-tools-extra] r354558 - [clangd] Handle another incomplete-type diagnostic case in IncludeFixer.
Eric Liu via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 21 01:33:49 PST 2019
Author: ioeric
Date: Thu Feb 21 01:33:49 2019
New Revision: 354558
URL: http://llvm.org/viewvc/llvm-project?rev=354558&view=rev
Log:
[clangd] Handle another incomplete-type diagnostic case in IncludeFixer.
Modified:
clang-tools-extra/trunk/clangd/IncludeFixer.cpp
clang-tools-extra/trunk/unittests/clangd/DiagnosticsTests.cpp
Modified: clang-tools-extra/trunk/clangd/IncludeFixer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/IncludeFixer.cpp?rev=354558&r1=354557&r2=354558&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/IncludeFixer.cpp (original)
+++ clang-tools-extra/trunk/clangd/IncludeFixer.cpp Thu Feb 21 01:33:49 2019
@@ -67,6 +67,7 @@ std::vector<Fix> IncludeFixer::fix(Diagn
case diag::err_incomplete_type:
case diag::err_incomplete_member_access:
case diag::err_incomplete_base_class:
+ case diag::err_incomplete_nested_name_spec:
// Incomplete type diagnostics should have a QualType argument for the
// incomplete type.
for (unsigned Idx = 0; Idx < Info.getNumArgs(); ++Idx) {
Modified: clang-tools-extra/trunk/unittests/clangd/DiagnosticsTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/DiagnosticsTests.cpp?rev=354558&r1=354557&r2=354558&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/DiagnosticsTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/DiagnosticsTests.cpp Thu Feb 21 01:33:49 2019
@@ -311,6 +311,7 @@ TEST(IncludeFixerTest, IncompleteType) {
Annotations Test(R"cpp(
$insert[[]]namespace ns {
class X;
+ $nested[[X::]]Nested n;
}
class Y : $base[[public ns::X]] {};
int main() {
@@ -326,6 +327,10 @@ int main() {
EXPECT_THAT(
TU.build().getDiagnostics(),
UnorderedElementsAre(
+ AllOf(Diag(Test.range("nested"),
+ "incomplete type 'ns::X' named in nested name specifier"),
+ WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
+ "Add include \"x.h\" for symbol ns::X"))),
AllOf(Diag(Test.range("base"), "base class has incomplete type"),
WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
"Add include \"x.h\" for symbol ns::X"))),
More information about the cfe-commits
mailing list