mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Serialize the source order of Decls appearing in their original source file.
We used to think the source order is preserved after de-serialization; however, this seems to be not the case.
This commit is contained in:
@@ -597,6 +597,7 @@ public:
|
||||
}
|
||||
result.Raw = RawComment(Comments);
|
||||
result.Group = endian::readNext<uint32_t, little, unaligned>(data);
|
||||
result.SourceOrder = endian::readNext<uint32_t, little, unaligned>(data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
@@ -1582,6 +1583,7 @@ Optional<StringRef> ModuleFile::getGroupNameForDecl(const Decl *D) const {
|
||||
return getGroupNameById(Triple.getValue().Group);
|
||||
}
|
||||
|
||||
|
||||
Optional<StringRef>
|
||||
ModuleFile::getSourceFileNameForDecl(const Decl *D) const {
|
||||
auto GroupD = getGroupDecl(D);
|
||||
@@ -1592,6 +1594,15 @@ ModuleFile::getSourceFileNameForDecl(const Decl *D) const {
|
||||
return getSourceFileNameById(Triple.getValue().Group);
|
||||
}
|
||||
|
||||
Optional<unsigned>
|
||||
ModuleFile::getSourceOrderForDecl(const Decl *D) const {
|
||||
auto Triple = getCommentForDecl(D);
|
||||
if (!Triple.hasValue()) {
|
||||
return None;
|
||||
}
|
||||
return Triple.getValue().SourceOrder;
|
||||
}
|
||||
|
||||
void ModuleFile::collectAllGroups(std::vector<StringRef> &Names) const {
|
||||
if (!GroupNamesMap)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user