[clangd] Suggest adding missing includes for incomplete type diagnostics.
authorEric Liu <ioeric@google.com>
Mon, 28 Jan 2019 14:01:55 +0000 (14:01 +0000)
committerEric Liu <ioeric@google.com>
Mon, 28 Jan 2019 14:01:55 +0000 (14:01 +0000)
commitdd66277c36af442460c60dc993b41b831ee28973
treea553ff33620d144f505a9b64f6bd0233727c6327
parent6d5348cca557fe16675bdcafe504103c530f2aab
[clangd] Suggest adding missing includes for incomplete type diagnostics.

Summary:
This enables clangd to intercept compiler diagnostics and attach fixes (e.g. by
querying index). This patch adds missing includes for incomplete types e.g.
member access into class with only forward declaration. This would allow adding
missing includes for user-typed symbol names that are missing declarations
(e.g. typos) in the future.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, ilya-biryukov, javed.absar, MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D56903

llvm-svn: 352361
26 files changed:
clang-tools-extra/clangd/CMakeLists.txt
clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/ClangdServer.h
clang-tools-extra/clangd/ClangdUnit.cpp
clang-tools-extra/clangd/ClangdUnit.h
clang-tools-extra/clangd/CodeComplete.cpp
clang-tools-extra/clangd/Compiler.h
clang-tools-extra/clangd/Diagnostics.cpp
clang-tools-extra/clangd/Diagnostics.h
clang-tools-extra/clangd/Headers.cpp
clang-tools-extra/clangd/Headers.h
clang-tools-extra/clangd/IncludeFixer.cpp [new file with mode: 0644]
clang-tools-extra/clangd/IncludeFixer.h [new file with mode: 0644]
clang-tools-extra/clangd/SourceCode.cpp
clang-tools-extra/clangd/SourceCode.h
clang-tools-extra/clangd/tool/ClangdMain.cpp
clang-tools-extra/unittests/clangd/CMakeLists.txt
clang-tools-extra/unittests/clangd/ClangdUnitTests.cpp
clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp
clang-tools-extra/unittests/clangd/DiagnosticsTests.cpp [new file with mode: 0644]
clang-tools-extra/unittests/clangd/FileIndexTests.cpp
clang-tools-extra/unittests/clangd/TUSchedulerTests.cpp
clang-tools-extra/unittests/clangd/TestIndex.cpp
clang-tools-extra/unittests/clangd/TestIndex.h
clang-tools-extra/unittests/clangd/TestTU.cpp
clang-tools-extra/unittests/clangd/TestTU.h