mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CursorInfo] Add Clang documentation to SymbolGraph output
This currently doesn't check for inherited docs, ie. either the imported declaration has docs or it doesn't. There's also a few odd cases with mixed doc types and when each line is prefixed with '*', but it's good enough for an initial implementation. Moves UTF8 sanitisation out of ASTPrinter.h and into Unicode.h so that it can be used here as well. Resolves rdar://91388603.
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "swift/AST/PrintOptions.h"
|
||||
#include "swift/AST/SourceFile.h"
|
||||
#include "swift/Basic/PrimitiveParsing.h"
|
||||
#include "swift/Basic/Unicode.h"
|
||||
#include "swift/ClangImporter/ClangImporter.h"
|
||||
#include "swift/ClangImporter/ClangModule.h"
|
||||
#include "swift/Parse/Token.h"
|
||||
@@ -977,7 +978,7 @@ void ClangCommentPrinter::printDeclPost(const Decl *D,
|
||||
return;
|
||||
|
||||
for (auto CommentText : PendingComments) {
|
||||
*this << " " << ASTPrinter::sanitizeUtf8(CommentText);
|
||||
*this << " " << unicode::sanitizeUTF8(CommentText);
|
||||
}
|
||||
PendingComments.clear();
|
||||
if (auto ClangN = swift::ide::getEffectiveClangNode(D))
|
||||
@@ -1068,7 +1069,7 @@ void ClangCommentPrinter::printComment(StringRef RawText, unsigned StartCol) {
|
||||
trimLeadingWhitespaceFromLines(RawText, WhitespaceToTrim, Lines);
|
||||
|
||||
for (auto Line : Lines) {
|
||||
*this << ASTPrinter::sanitizeUtf8(Line) << "\n";
|
||||
*this << unicode::sanitizeUTF8(Line) << "\n";
|
||||
printIndent();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user