Sourcekit/DocSupport: fix an assertion when generating documentation for extensions with attributes

When sanitizing the documentation comments for synthesized extensions,
we expect some text like "<declaration>extension". This isn't the case
when use-facing attributes are present.

rdar://50913510
This commit is contained in:
Xi Ge
2019-05-20 17:33:53 -07:00
parent 3b4bb1960d
commit 1ca8e83aa3
5 changed files with 1359 additions and 1207 deletions

View File

@@ -368,7 +368,7 @@ static bool initDocEntityInfo(const Decl *D,
StringRef DocRef = (StringRef)DocBuffer;
if (IsSynthesizedExtension &&
DocRef.find("<Declaration>") != StringRef::npos) {
StringRef Open = "<Declaration>extension ";
StringRef Open = "extension ";
assert(DocRef.find(Open) != StringRef::npos);
auto FirstPart = DocRef.substr(0, DocRef.find(Open) + (Open).size());
auto SecondPart = DocRef.substr(FirstPart.size());