[SourceKit] Add documentation range in structure (SR-2487) (#11264)

This commit is contained in:
Marcelo Fabri
2017-08-02 20:39:49 +00:00
committed by Xi Ge
parent 0c44bbd9a5
commit d16cce3a94
15 changed files with 136 additions and 37 deletions

View File

@@ -247,3 +247,18 @@ StringRef Decl::getBriefComment() const {
Context.setBriefComment(this, Result);
return Result;
}
CharSourceRange RawComment::getCharSourceRange() {
if (this->isEmpty()) {
return CharSourceRange();
}
auto Start = this->Comments.front().Range.getStart();
if (Start.isInvalid()) {
return CharSourceRange();
}
auto End = this->Comments.back().Range.getEnd();
auto Length = (char *)End.getOpaquePointerValue() -
(char* )Start.getOpaquePointerValue();
return CharSourceRange(Start, Length);
}