malaperle added inline comments.
================ Comment at: clangd/Symbol.h:23 + // The path of the source file where a symbol occurs. + std::string FilePath; + // The offset to the first character of the symbol from the beginning of the ---------------- malaperle wrote: > sammccall wrote: > > ioeric wrote: > > > Is this relative or absolute? > > Having every symbol own a copy of the filepath seems wasteful. > > It seems likely that the index will have per-file information too, so this > > representation should likely be a key to that. Hash of the filepath might > > work? > How we model it is that a symbol doesn't have a "location", but its > occurrence do. One could consider the location of a symbol to be either its > declaration occurrence (SymbolRole::Declaration) or its definition > (SymbolRole::Definition). > What we do to get the location path is each occurrence has a pointer (a > "database" pointer, but it doesn't matter) to a file entry and then we get > the path from the entry. > > So conceptually, it works a bit like this (although it fetches information on > disk). > ``` > class IndexOccurrence { > IndexOccurrence *FilePtr; > > std::string Occurrence::getPath() { > return FilePtr->getPath(); > } > }; > ``` Oops, wrong type for the field, it should have been: ``` class IndexOccurrence { IndexFile *FilePtr; std::string Occurrence::getPath() { return FilePtr->getPath(); } }; ``` Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D40897 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits