sammccall added inline comments.
================
Comment at: clangd/index/CanonicalIncludes.cpp:54
+ StringRef Header = *I;
+ if (!isLiteralInclude(Header)) {
+ // If Header is not expected be included (e.g. .cc file), we fall back to
----------------
headers are paths, not <quoted>, right?
================
Comment at: clangd/index/CanonicalIncludes.cpp:55
+ if (!isLiteralInclude(Header)) {
+ // If Header is not expected be included (e.g. .cc file), we fall back to
+ // the declaring header.
----------------
This logic could be merged with the .inc logic, right?
"Find the first header such that the extension is not '.inc', and isn't a
recognized non-header file"
================
Comment at: clangd/index/CanonicalIncludes.cpp:60
+ if (!Ext.empty() && !driver::types::onlyPrecompileType(
+ driver::types::lookupTypeForExtension(Ext)))
+ return Headers[0];
----------------
lookupTypeForExtension can return TY_INVALID, which you have to check for
(onlyPrecompileType will assert).
I think we should be conservative and accept TY_INVALID as possible headers -
our goal here really is to exclude "obvious" non-headers like cpp.
(in this case you can probably drop the explicit empty check)
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D47187
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits