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

Christian Kandeler via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 2 06:51:50 PDT 2021


ckandeler added a comment.

> 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)

The headers are, as far as I can tell, always located in a directory whose name starts with "Qt". This parent directory is also in the include path, so e.g. to get access to QString, which is located under QtCore/, you'd typically just write:

  #include <QString>

This is the recommended, documented way of pulling in headers.
Though you could also write:

  #include <QtCore/QString>

as the parent parent directory is also in the list of include paths.

Looking at the code, it seems we have access to the parent directory, so we could do that name check (which I suppose has less potential for false positives than checking the file name).
For framework builds, the directory would be "Headers", which also seems safe.


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