[PATCH] D60815: [clangd] Recognize "don't include me directly" pattern, and suppress include insertion.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 17 03:39:14 PDT 2019
sammccall created this revision.
sammccall added a reviewer: ioeric.
Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.
Typically used with umbrella headers, e.g. GTK:
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
Heuristic is fairly conservative, a quick code search over github showed
a fair number of hits and few/no false positives. (Not all were umbrella
headers, but I'd be happy avoiding include insertion for all of them).
We may want to relax the heuristic later to catch more cases.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D60815
Files:
clangd/index/SymbolCollector.cpp
clangd/index/SymbolCollector.h
unittests/clangd/SymbolCollectorTests.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60815.195532.patch
Type: text/x-patch
Size: 8187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190417/9d6dc054/attachment.bin>
More information about the cfe-commits
mailing list