[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:
Xi Ge
2016-03-08 11:00:00 -08:00
parent 7a3276738b
commit c84f667676
9 changed files with 54 additions and 4 deletions

View File

@@ -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;