[PATCH] D112996: [CodeCompletion] Generally consider header files without extension

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 28 12:45:46 PST 2022


HazardyKnusperkeks added a comment.

I have a similar structure to Qt regarding the headers and use clangd trough the QtCreator, so for my own libraries I cannot use the auto completion.

In D112996#3102782 <https://reviews.llvm.org/D112996#3102782>, @sammccall wrote:

>> the files are located in include directories
>
> These are directories that **may** contain headers, not directories that **only** contain headers. (Which we mostly expect `-Isystem` to be).
> For example, many projects keep headers next to sources, and so have sources on their include path. And the directory containing the current file is always on the include path.
> We'd expect to see `Makefile`, `SConstruct`, `BUILD` files etc here. And maybe a smattering of "random" files that don't follow particular conventions.
>
> Trying to support QT headers seems very reasonable though. Seems like our options are:
>
> - current behavior with false negatives on QT
> - proposed behavior with false positives on Makefile etc
> - current behavior and try to detect QT as an exception
> - proposed behavior and try to detect Makefile etc as exceptions
>
> WDYT about detecting QT headers specifically? It seems hacky, but I don't see a way out of this that doesn't involve hardcoding some filenames. Are they in a directory like `"qt-11/QFoo"` that we can recognize? Even Q followed by another capital letter might be a good enough heuristic.
> (The docs suggest it's just `<QFoo>` but the docs also say to use angle brackets so I'm not sure whether to believe them)

Could we extend the heuristic to match directories called `include`? For me it is

  Path to Library                   .../code/cast
  - include                         .../code/cast/include
    - LibraryName                   .../code/cast/include/Cast
      - Header                      .../code/cast/include/Cast/Signed

And for that I want `#include <Cast/` to offer `Signed>`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112996/new/

https://reviews.llvm.org/D112996



More information about the cfe-commits mailing list