[PATCH] D115490: [clangd] Include fixer for missing functions in C

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 9 19:56:26 PST 2021


sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: usaxena95, arphaman.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added projects: clang, clang-tools-extra.

A function call `unresolved()` in C will generate an implicit declaration
of the missing function and warn `ext_implicit_function_decl` or so.
(Compared to in C++ where we get `err_undeclared_var_use`).
We want to try to resolve these names.

Unfortunately typo correction is disabled in sema for performance
reasons unless this warning is promoted to error.
(We need typo correction for include-fixer.)
It's not clear to me where a switch to force this correction on should
go, include-fixer is kind of a hack. So hack more by telling sema we're
promoting them to error.

Fixes https://github.com/clangd/clangd/issues/937


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115490

Files:
  clang-tools-extra/clangd/Diagnostics.cpp
  clang-tools-extra/clangd/IncludeFixer.cpp
  clang-tools-extra/clangd/ParsedAST.cpp
  clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
  clang/lib/Sema/SemaDecl.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115490.393369.patch
Type: text/x-patch
Size: 8351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211210/bb998c3f/attachment-0001.bin>


More information about the cfe-commits mailing list