@@ -175,17 +175,25 @@ void Symbol::serializeDocComment(llvm::json::OStream &OS) const {
175175
176176 OS.attributeObject (" docComment" , [&](){
177177 auto LL = Graph->Ctx .getLineList (RC);
178- size_t InitialIndentation = LL.getLines ().empty ()
178+ StringRef FirstNonBlankLine;
179+ for (const auto &Line : LL.getLines ()) {
180+ if (!Line.Text .empty ()) {
181+ FirstNonBlankLine = Line.Text ;
182+ break ;
183+ }
184+ }
185+ size_t InitialIndentation = FirstNonBlankLine.empty ()
179186 ? 0
180- : markup::measureIndentation (LL. getLines (). front (). Text );
187+ : markup::measureIndentation (FirstNonBlankLine );
181188 OS.attributeArray (" lines" , [&](){
182189 for (const auto &Line : LL.getLines ()) {
183190 // Line object
184191 OS.object ([&](){
185192 // Trim off any initial indentation from the line's
186193 // text and start of its source range, if it has one.
187194 if (Line.Range .isValid ()) {
188- serializeRange (InitialIndentation,
195+ serializeRange (std::min (InitialIndentation,
196+ Line.FirstNonspaceOffset ),
189197 Line.Range , Graph->M .getASTContext ().SourceMgr , OS);
190198 }
191199 auto TrimmedLine = Line.Text .drop_front (std::min (InitialIndentation,
0 commit comments