Skip to content

Commit 637355b

Browse files
ahoppenRajveer
authored andcommitted
[CursorInfo] Deliver results from solver-based cursor info
Running the SourceKit stress tester with verification of solver-based cursor info returned quite a few differences but in all of them, the old AST-based implementation was actually incorrect. So, instead of verifying the results, deliver the results from solver-baesd cursor info and only fall back to AST-based cursor info if the solver-based implementation returned no results. rdar://103369449
1 parent 8dc142e commit 637355b

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

tools/SourceKit/include/SourceKit/Core/LangSupport.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,7 @@ struct CursorSymbolInfo {
519519

520520
llvm::Optional<unsigned> ParentNameOffset;
521521

522-
void print(llvm::raw_ostream &OS, std::string Indentation,
523-
bool ForSolverBasedCursorInfoVerification = false) const {
522+
void print(llvm::raw_ostream &OS, std::string Indentation) const {
524523
OS << Indentation << "CursorSymbolInfo" << '\n';
525524
OS << Indentation << " Kind: " << Kind.getName() << '\n';
526525
OS << Indentation << " DeclarationLang: " << DeclarationLang.getName()
@@ -529,14 +528,7 @@ struct CursorSymbolInfo {
529528
OS << Indentation << " USR: " << USR << '\n';
530529
OS << Indentation << " TypeName: " << TypeName << '\n';
531530
OS << Indentation << " TypeUSR: " << TypeUSR << '\n';
532-
// The ContainerTypeUSR varies too much between the solver-based and
533-
// AST-based implementation. A few manual inspections showed that the
534-
// solver-based container is usually more correct than the old. Instead of
535-
// fixing the AST-based container type computation, exclude the container
536-
// type from the verification.
537-
if (!ForSolverBasedCursorInfoVerification) {
538-
OS << Indentation << " ContainerTypeUSR: " << ContainerTypeUSR << '\n';
539-
}
531+
OS << Indentation << " ContainerTypeUSR: " << ContainerTypeUSR << '\n';
540532
OS << Indentation << " DocComment: " << DocComment << '\n';
541533
OS << Indentation << " GroupName: " << GroupName << '\n';
542534
OS << Indentation << " LocalizationKey: " << LocalizationKey << '\n';
@@ -604,7 +596,7 @@ struct CursorInfoData {
604596
OS << Indentation << "CursorInfoData" << '\n';
605597
OS << Indentation << " Symbols:" << '\n';
606598
for (auto Symbol : Symbols) {
607-
Symbol.print(OS, Indentation + " ", ForSolverBasedCursorInfoVerification);
599+
Symbol.print(OS, Indentation + " ");
608600
}
609601
OS << Indentation << " AvailableActions:" << '\n';
610602
for (auto AvailableAction : AvailableActions) {

0 commit comments

Comments
 (0)