Skip to content

Commit 1f70d8f

Browse files
authored
Revert "[5.6] Multiple symbol-graph regressions"
1 parent 71b06cf commit 1f70d8f

File tree

13 files changed

+25
-117
lines changed

13 files changed

+25
-117
lines changed

include/swift/AST/FileUnit.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "swift/AST/Module.h"
1717
#include "swift/AST/RawComment.h"
1818
#include "swift/Basic/BasicSourceInfo.h"
19-
#include "swift/Basic/Debug.h"
2019

2120
#include "llvm/ADT/PointerIntPair.h"
2221

@@ -309,9 +308,6 @@ class FileUnit : public DeclContext, public ASTAllocated<FileUnit> {
309308
return getParentModule()->getRealName().str();
310309
}
311310

312-
SWIFT_DEBUG_DUMPER(dumpDisplayDecls());
313-
SWIFT_DEBUG_DUMPER(dumpTopLevelDecls());
314-
315311
/// Traverse the decls within this file.
316312
///
317313
/// \returns true if traversal was aborted, false if it completed

include/swift/AST/Module.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "swift/AST/Type.h"
2727
#include "swift/Basic/BasicSourceInfo.h"
2828
#include "swift/Basic/Compiler.h"
29-
#include "swift/Basic/Debug.h"
3029
#include "swift/Basic/OptionSet.h"
3130
#include "swift/Basic/STLExtras.h"
3231
#include "swift/Basic/SourceLoc.h"
@@ -857,9 +856,6 @@ class ModuleDecl
857856
/// transferred from module files to the dSYMs, remove this.
858857
bool isExternallyConsumed() const;
859858

860-
SWIFT_DEBUG_DUMPER(dumpDisplayDecls());
861-
SWIFT_DEBUG_DUMPER(dumpTopLevelDecls());
862-
863859
SourceRange getSourceRange() const { return SourceRange(); }
864860

865861
static bool classof(const DeclContext *DC) {

include/swift/AST/SourceFile.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,6 @@ class SourceFile final : public FileUnit {
288288

289289
~SourceFile();
290290

291-
bool hasImports() const {
292-
return Imports.hasValue();
293-
}
294-
295291
/// Retrieve an immutable view of the source file's imports.
296292
ArrayRef<AttributedImport<ImportedModule>> getImports() const {
297293
return *Imports;

lib/AST/Module.cpp

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -780,22 +780,6 @@ void SourceFile::lookupObjCMethods(
780780
results.append(known->second.begin(), known->second.end());
781781
}
782782

783-
static void collectParsedExportedImports(const ModuleDecl *M, SmallPtrSetImpl<ModuleDecl *> &Imports) {
784-
for (const FileUnit *file : M->getFiles()) {
785-
if (const SourceFile *source = dyn_cast<SourceFile>(file)) {
786-
if (source->hasImports()) {
787-
for (auto import : source->getImports()) {
788-
if (import.options.contains(ImportFlags::Exported)) {
789-
if (!Imports.contains(import.module.importedModule)) {
790-
Imports.insert(import.module.importedModule);
791-
}
792-
}
793-
}
794-
}
795-
}
796-
}
797-
}
798-
799783
void ModuleDecl::getLocalTypeDecls(SmallVectorImpl<TypeDecl*> &Results) const {
800784
FORWARD(getLocalTypeDecls, (Results));
801785
}
@@ -804,24 +788,6 @@ void ModuleDecl::getTopLevelDecls(SmallVectorImpl<Decl*> &Results) const {
804788
FORWARD(getTopLevelDecls, (Results));
805789
}
806790

807-
void ModuleDecl::dumpDisplayDecls() const {
808-
SmallVector<Decl *, 32> Decls;
809-
getDisplayDecls(Decls);
810-
for (auto *D : Decls) {
811-
D->dump(llvm::errs());
812-
llvm::errs() << "\n";
813-
}
814-
}
815-
816-
void ModuleDecl::dumpTopLevelDecls() const {
817-
SmallVector<Decl *, 32> Decls;
818-
getTopLevelDecls(Decls);
819-
for (auto *D : Decls) {
820-
D->dump(llvm::errs());
821-
llvm::errs() << "\n";
822-
}
823-
}
824-
825791
void ModuleDecl::getExportedPrespecializations(
826792
SmallVectorImpl<Decl *> &Results) const {
827793
FORWARD(getExportedPrespecializations, (Results));
@@ -942,23 +908,8 @@ SourceFile::getExternalRawLocsForDecl(const Decl *D) const {
942908
}
943909

944910
void ModuleDecl::getDisplayDecls(SmallVectorImpl<Decl*> &Results) const {
945-
if (isParsedModule(this)) {
946-
SmallPtrSet<ModuleDecl *, 4> Modules;
947-
collectParsedExportedImports(this, Modules);
948-
for (const ModuleDecl *import : Modules) {
949-
import->getDisplayDecls(Results);
950-
}
951-
}
952911
// FIXME: Should this do extra access control filtering?
953912
FORWARD(getDisplayDecls, (Results));
954-
955-
#ifndef NDEBUG
956-
llvm::DenseSet<Decl *> visited;
957-
for (auto *D : Results) {
958-
auto inserted = visited.insert(D).second;
959-
assert(inserted && "there should be no duplicate decls");
960-
}
961-
#endif
962913
}
963914

964915
ProtocolConformanceRef
@@ -3114,22 +3065,6 @@ void FileUnit::getTopLevelDeclsWhereAttributesMatch(
31143065
Results.erase(newEnd, Results.end());
31153066
}
31163067

3117-
void FileUnit::dumpDisplayDecls() const {
3118-
SmallVector<Decl *, 32> Decls;
3119-
getDisplayDecls(Decls);
3120-
for (auto *D : Decls) {
3121-
D->dump(llvm::errs());
3122-
}
3123-
}
3124-
3125-
void FileUnit::dumpTopLevelDecls() const {
3126-
SmallVector<Decl *, 32> Decls;
3127-
getTopLevelDecls(Decls);
3128-
for (auto *D : Decls) {
3129-
D->dump(llvm::errs());
3130-
}
3131-
}
3132-
31333068
void swift::simple_display(llvm::raw_ostream &out, const FileUnit *file) {
31343069
if (!file) {
31353070
out << "(null)";

lib/SymbolGraphGen/SymbolGraph.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ PrintOptions SymbolGraph::getDeclarationFragmentsPrintOptions() const {
9999
ExcludeAttrs.insert(std::make_pair("DAK_Postfix", DAK_Postfix));
100100
ExcludeAttrs.insert(std::make_pair("DAK_Infix", DAK_Infix));
101101

102-
// In "emit modules separately" jobs, access modifiers show up as attributes,
103-
// but we don't want them to be printed in declarations
104-
ExcludeAttrs.insert(std::make_pair("DAK_AccessControl", DAK_AccessControl));
105-
106102
for (const auto &Entry : ExcludeAttrs) {
107103
Opts.ExcludeAttrList.push_back(Entry.getValue());
108104
}

test/SourceKit/CursorInfo/cursor_symbol_graph.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ enum MyEnum {
182182
// CHECKY: "symbols": [
183183
// CHECKY: {
184184
// CHECKY: "accessLevel": "private",
185+
// CHECKY: "declarationFragments": [
186+
// CHECKY: {
187+
// CHECKY: "kind": "keyword",
188+
// CHECKY: "spelling": "private"
189+
// CHECKY: },
190+
// CHECKY: {
191+
// CHECKY: "kind": "text",
192+
// CHECKY: "spelling": " "
193+
// CHECKY: },
185194
// CHECKY: {
186195
// CHECKY: "kind": "keyword",
187196
// CHECKY: "spelling": "var"

test/SourceKit/CursorInfo/cursor_symbol_graph_referenced.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@ extension Parent {
237237
// PRIVATE: "declarationFragments": [
238238
// PRIVATE-NEXT: {
239239
// PRIVATE-NEXT: "kind": "keyword",
240+
// PRIVATE-NEXT: "spelling": "private"
241+
// PRIVATE-NEXT: },
242+
// PRIVATE-NEXT: {
243+
// PRIVATE-NEXT: "kind": "text",
244+
// PRIVATE-NEXT: "spelling": " "
245+
// PRIVATE-NEXT: },
246+
// PRIVATE-NEXT: {
247+
// PRIVATE-NEXT: "kind": "keyword",
240248
// PRIVATE-NEXT: "spelling": "func"
241249
// PRIVATE-NEXT: },
242250
// PRIVATE-NEXT: {
@@ -294,6 +302,14 @@ extension Parent {
294302
// SPI: "declarationFragments": [
295303
// SPI-NEXT: {
296304
// SPI-NEXT: "kind": "keyword",
305+
// SPI-NEXT: "spelling": "internal"
306+
// SPI-NEXT: },
307+
// SPI-NEXT: {
308+
// SPI-NEXT: "kind": "text",
309+
// SPI-NEXT: "spelling": " "
310+
// SPI-NEXT: },
311+
// SPI-NEXT: {
312+
// SPI-NEXT: "kind": "keyword",
297313
// SPI-NEXT: "spelling": "func"
298314
// SPI-NEXT: },
299315
// SPI-NEXT: {

test/SymbolGraph/ClangImporter/EmitWhileBuilding.swift

Lines changed: 0 additions & 30 deletions
This file was deleted.

test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/Headers/EmitWhileBuilding.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/Modules/EmitWhileBuilding.swiftmodule/.keep

Whitespace-only changes.

test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/ObjcProperty

Whitespace-only changes.

test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/module.map

Lines changed: 0 additions & 4 deletions
This file was deleted.

test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/Extra.swift

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)