[PATCH] D112996: [CodeCompletion] Generally consider header files without extension
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 2 11:37:15 PDT 2021
sammccall added a comment.
In D112996#3102925 <https://reviews.llvm.org/D112996#3102925>, @ckandeler wrote:
>> 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).
Yeah, that makes sense to me. Also a bit cheaper since we only have to do this once per parent dir.
> For framework builds, the directory would be "Headers", which also seems safe.
I agree extensionless headers in frameworks seem fine to show.
We already know which includepath entries are frameworks, so we can just use that info directly (see line 9674)
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