[SourceKit] In CursorInfo response, include the mangle name of the type of the underlying decl.

The mangled name of the type is identical to those for debugger. These
mangled names allow us to reconstruct the type from AST and generate interface
specifically for that type.

Related rdar://27306890
This commit is contained in:
Xi Ge
2016-07-12 12:01:37 -07:00
parent e9688dc41b
commit a5e51a3494
14 changed files with 67 additions and 13 deletions

View File

@@ -657,6 +657,13 @@ static bool passCursorInfoForDecl(const ValueDecl *VD,
}
unsigned TypenameEnd = SS.size();
unsigned MangledTypeStart = SS.size();
{
llvm::raw_svector_ostream OS(SS);
SwiftLangSupport::printDeclTypeUSR(VD, OS);
}
unsigned MangledTypeEnd = SS.size();
unsigned DocCommentBegin = SS.size();
{
llvm::raw_svector_ostream OS(SS);
@@ -772,6 +779,8 @@ static bool passCursorInfoForDecl(const ValueDecl *VD,
StringRef USR = StringRef(SS.begin()+USRBegin, USREnd-USRBegin);
StringRef TypeName = StringRef(SS.begin()+TypenameBegin,
TypenameEnd-TypenameBegin);
StringRef TypeUsr = StringRef(SS.begin()+MangledTypeStart,
MangledTypeEnd - MangledTypeStart);
StringRef DocComment = StringRef(SS.begin()+DocCommentBegin,
DocCommentEnd-DocCommentBegin);
StringRef AnnotatedDecl = StringRef(SS.begin()+DeclBegin,
@@ -812,6 +821,7 @@ static bool passCursorInfoForDecl(const ValueDecl *VD,
Info.Name = Name;
Info.USR = USR;
Info.TypeName = TypeName;
Info.TypeUSR = TypeUsr;
Info.DocComment = DocComment;
Info.AnnotatedDeclaration = AnnotatedDecl;
Info.FullyAnnotatedDeclaration = FullyAnnotatedDecl;