Overview
| Artifact ID: | 6654efac69c9d4cc90f2ff95d1751e837881f01ba7a9eb0c27884b72bfffda4e |
|---|---|
| Ticket: | c7dc599e73a7094298594c4383ad3524f009e6f8
Add IWYU export pragma annotations for improved clangd and clang-tidy diagnostics |
| User & Date: | hzeller on 2025-10-24 16:16:13 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-plain"
- comment changed to:
Someone including the toplevel "tcl.h" header might get misc-include-cleaner warnings from the clangd language server and clang-tidy in their projects for some symbols that are only provided by the "tclDecls.h" or "tclPlatDecls.h" headers as they are not _directly_ included. The annotation with IWYU pragmas fixes that and tells the tools that it should consider that these includes indeed should be considered as exporting the symbols and thus as if they directly provided the symbol Documentation clangd and clang-tidy https://clang.llvm.org/extra/clang-tidy/checks/misc/include-cleaner.html points to https://clangd.llvm.org/design/include-cleaner#iwyu-pragmas This has been first implemented and docuemnted in the include-what-you-use project https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md#iwyu-pragma-begin_exportsend_exports === 8< === Patch ==== --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2343,7 +2343,7 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv); * table. */ -#include "tclDecls.h" +#include "tclDecls.h" /* IWYU pragma: export */ /* * Include platform specific public function declarations that are accessible @@ -2356,7 +2356,7 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv); # define TCLAPI MODULE_SCOPE #endif -#include "tclPlatDecls.h" +#include "tclPlatDecls.h" /* IWYU pragma: export */ /* *----------------------------------------------------------------------------
- foundin changed to: "head"
- is_private changed to: "0"
- login: "hzeller"
- priority changed to: "5 Medium"
- private_contact changed to: "9bef9914fb30c8aedb6cfa0bafc4b43d058d4e85"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "hzeller"
- subsystem changed to: "None"
- title changed to:
Add IWYU export pragma annotations for improved clangd and clang-tidy diagnostics
- type changed to: "Patch"