[all-commits] [llvm/llvm-project] 1ab137: [clangd] Include fixer for missing functions in C

Sam McCall via All-commits all-commits at lists.llvm.org
Mon Jan 10 03:17:33 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1ab13793beafd1db0159a410560b3ce998b15f5e
      https://github.com/llvm/llvm-project/commit/1ab13793beafd1db0159a410560b3ce998b15f5e
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2022-01-10 (Mon, 10 Jan 2022)

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

  Log Message:
  -----------
  [clangd] Include fixer for missing functions in C

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

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




More information about the All-commits mailing list