Symbols with different canonical includes might be defined in the same header
(e.g. symbols defined in STL <iosfwd>). This patch adds support for mapping from
qualified symbol names to canonical headers and special mapping for symbols in <iosfwd>
Details
Diff Detail
- Repository
- rCTE Clang Tools Extra
Event Timeline
clangd/index/CanonicalIncludes.cpp | ||
---|---|---|
83 | Looks like the list only contains stream-related symbols, there are some symbols in <iosfwd> not covered, is it intended? Maybe we keep the order of this map the same as the one listed in http://en.cppreference.com/w/cpp/header/iosfwd? That would make it easier to see the difference? | |
unittests/clangd/SymbolCollectorTests.cpp | ||
561 | The STL implementation of ios is a typedef typedef basic_ios<char> ios; , I think we should make the test align with it? |
clangd/index/CanonicalIncludes.cpp | ||
---|---|---|
83 | Although allocator could be exposed by <iosfwd>, it's not defined in <iosfwd>, so we don't need to handle it specially. I am sorting the symbols by their canonical headers, which I think would make it easier to check the header mapping. | |
unittests/clangd/SymbolCollectorTests.cpp | ||
561 | The symbol mapping doesn't make a difference between symbol types, and symbol kind test is not in the scope of this patch, so I think this wouldn't be necessary here. |
clangd/index/CanonicalIncludes.h | ||
---|---|---|
47 | Nit: "Symbol mappings take precedence over header mappings"? | |
51 | Nit: rephrase as "returns the canonical include for \p Symbol, which is declared in \p Header"? | |
53–56 | Why can't we always provide this? | |
unittests/clangd/SymbolCollectorTests.cpp | ||
561 | I'd be +1 on matching the real header a bit more so it's more obvious how this relates to the standard library. As long as it's not too hard! |
- Merge with origin/master
- Address review comments.
clangd/index/CanonicalIncludes.h | ||
---|---|---|
53–56 | I think it would be better to keep supporting the header-only mapping use case. | |
unittests/clangd/SymbolCollectorTests.cpp | ||
561 | I'd prefer to keep the test case minimum so that it's clear that we are only matching on names. |
Nit: "Symbol mappings take precedence over header mappings"?