mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SymbolGraph: Serialize decl and raw comment locations
- Add DocRangesLayout to the `.swiftsourceinfo`. This is a blob containing an array of `SingleRawComment` source locations. - Add DocLocWriter for serializing `SingleRawComment` locs into the `DocLocsLayout` buffer. Serialize start line, start column, and length of `SingleRawComment` pieces in `.swiftsourceinfo` - Read doc locs when loading basic declaration locs from a ModuleFile. - Load `DOC_LOCS` blob into ModuleFile::DocLocsData - Reconstitute RawComment ranges when available from .swiftsourceinfo - Allow requesting serialized raw comment if available rdar://problem/58339492
This commit is contained in:
@@ -705,6 +705,14 @@ SourceFile::getBasicLocsForDecl(const Decl *D) const {
|
||||
SourceManager &SM = getASTContext().SourceMgr;
|
||||
BasicDeclLocs Result;
|
||||
Result.SourceFilePath = SM.getDisplayNameForLoc(D->getLoc());
|
||||
|
||||
for (const auto &SRC : D->getRawComment().Comments) {
|
||||
Result.DocRanges.push_back(std::make_pair(
|
||||
LineColumn { SRC.StartLine, SRC.StartColumn },
|
||||
SRC.Range.getByteLength())
|
||||
);
|
||||
}
|
||||
|
||||
auto setLineColumn = [&SM](LineColumn &Home, SourceLoc Loc) {
|
||||
if (Loc.isValid()) {
|
||||
std::tie(Home.Line, Home.Column) = SM.getLineAndColumn(Loc);
|
||||
|
||||
Reference in New Issue
Block a user