diff --git a/include/swift/AST/FileUnit.h b/include/swift/AST/FileUnit.h index 51cc26bd8e4f4..0417ea846368c 100644 --- a/include/swift/AST/FileUnit.h +++ b/include/swift/AST/FileUnit.h @@ -16,7 +16,6 @@ #include "swift/AST/Module.h" #include "swift/AST/RawComment.h" #include "swift/Basic/BasicSourceInfo.h" -#include "swift/Basic/Debug.h" #include "llvm/ADT/PointerIntPair.h" @@ -309,9 +308,6 @@ class FileUnit : public DeclContext, public ASTAllocated { return getParentModule()->getRealName().str(); } - SWIFT_DEBUG_DUMPER(dumpDisplayDecls()); - SWIFT_DEBUG_DUMPER(dumpTopLevelDecls()); - /// Traverse the decls within this file. /// /// \returns true if traversal was aborted, false if it completed diff --git a/include/swift/AST/Module.h b/include/swift/AST/Module.h index d6e5a8ec6b69f..31bb84ad0480b 100644 --- a/include/swift/AST/Module.h +++ b/include/swift/AST/Module.h @@ -26,7 +26,6 @@ #include "swift/AST/Type.h" #include "swift/Basic/BasicSourceInfo.h" #include "swift/Basic/Compiler.h" -#include "swift/Basic/Debug.h" #include "swift/Basic/OptionSet.h" #include "swift/Basic/STLExtras.h" #include "swift/Basic/SourceLoc.h" @@ -857,9 +856,6 @@ class ModuleDecl /// transferred from module files to the dSYMs, remove this. bool isExternallyConsumed() const; - SWIFT_DEBUG_DUMPER(dumpDisplayDecls()); - SWIFT_DEBUG_DUMPER(dumpTopLevelDecls()); - SourceRange getSourceRange() const { return SourceRange(); } static bool classof(const DeclContext *DC) { diff --git a/include/swift/AST/SourceFile.h b/include/swift/AST/SourceFile.h index 9b7d221a60c45..99136c7051dba 100644 --- a/include/swift/AST/SourceFile.h +++ b/include/swift/AST/SourceFile.h @@ -288,10 +288,6 @@ class SourceFile final : public FileUnit { ~SourceFile(); - bool hasImports() const { - return Imports.hasValue(); - } - /// Retrieve an immutable view of the source file's imports. ArrayRef> getImports() const { return *Imports; diff --git a/lib/AST/Module.cpp b/lib/AST/Module.cpp index 1f8a1cd8605f5..613babc0fa46a 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -780,22 +780,6 @@ void SourceFile::lookupObjCMethods( results.append(known->second.begin(), known->second.end()); } -static void collectParsedExportedImports(const ModuleDecl *M, SmallPtrSetImpl &Imports) { - for (const FileUnit *file : M->getFiles()) { - if (const SourceFile *source = dyn_cast(file)) { - if (source->hasImports()) { - for (auto import : source->getImports()) { - if (import.options.contains(ImportFlags::Exported)) { - if (!Imports.contains(import.module.importedModule)) { - Imports.insert(import.module.importedModule); - } - } - } - } - } - } -} - void ModuleDecl::getLocalTypeDecls(SmallVectorImpl &Results) const { FORWARD(getLocalTypeDecls, (Results)); } @@ -804,24 +788,6 @@ void ModuleDecl::getTopLevelDecls(SmallVectorImpl &Results) const { FORWARD(getTopLevelDecls, (Results)); } -void ModuleDecl::dumpDisplayDecls() const { - SmallVector Decls; - getDisplayDecls(Decls); - for (auto *D : Decls) { - D->dump(llvm::errs()); - llvm::errs() << "\n"; - } -} - -void ModuleDecl::dumpTopLevelDecls() const { - SmallVector Decls; - getTopLevelDecls(Decls); - for (auto *D : Decls) { - D->dump(llvm::errs()); - llvm::errs() << "\n"; - } -} - void ModuleDecl::getExportedPrespecializations( SmallVectorImpl &Results) const { FORWARD(getExportedPrespecializations, (Results)); @@ -942,23 +908,8 @@ SourceFile::getExternalRawLocsForDecl(const Decl *D) const { } void ModuleDecl::getDisplayDecls(SmallVectorImpl &Results) const { - if (isParsedModule(this)) { - SmallPtrSet Modules; - collectParsedExportedImports(this, Modules); - for (const ModuleDecl *import : Modules) { - import->getDisplayDecls(Results); - } - } // FIXME: Should this do extra access control filtering? FORWARD(getDisplayDecls, (Results)); - -#ifndef NDEBUG - llvm::DenseSet visited; - for (auto *D : Results) { - auto inserted = visited.insert(D).second; - assert(inserted && "there should be no duplicate decls"); - } -#endif } ProtocolConformanceRef @@ -3114,22 +3065,6 @@ void FileUnit::getTopLevelDeclsWhereAttributesMatch( Results.erase(newEnd, Results.end()); } -void FileUnit::dumpDisplayDecls() const { - SmallVector Decls; - getDisplayDecls(Decls); - for (auto *D : Decls) { - D->dump(llvm::errs()); - } -} - -void FileUnit::dumpTopLevelDecls() const { - SmallVector Decls; - getTopLevelDecls(Decls); - for (auto *D : Decls) { - D->dump(llvm::errs()); - } -} - void swift::simple_display(llvm::raw_ostream &out, const FileUnit *file) { if (!file) { out << "(null)"; diff --git a/lib/SymbolGraphGen/SymbolGraph.cpp b/lib/SymbolGraphGen/SymbolGraph.cpp index 66fc5900489b0..e115a0928bcdc 100644 --- a/lib/SymbolGraphGen/SymbolGraph.cpp +++ b/lib/SymbolGraphGen/SymbolGraph.cpp @@ -99,10 +99,6 @@ PrintOptions SymbolGraph::getDeclarationFragmentsPrintOptions() const { ExcludeAttrs.insert(std::make_pair("DAK_Postfix", DAK_Postfix)); ExcludeAttrs.insert(std::make_pair("DAK_Infix", DAK_Infix)); - // In "emit modules separately" jobs, access modifiers show up as attributes, - // but we don't want them to be printed in declarations - ExcludeAttrs.insert(std::make_pair("DAK_AccessControl", DAK_AccessControl)); - for (const auto &Entry : ExcludeAttrs) { Opts.ExcludeAttrList.push_back(Entry.getValue()); } diff --git a/test/SourceKit/CursorInfo/cursor_symbol_graph.swift b/test/SourceKit/CursorInfo/cursor_symbol_graph.swift index 80794a94c4a1f..fca7007c94949 100644 --- a/test/SourceKit/CursorInfo/cursor_symbol_graph.swift +++ b/test/SourceKit/CursorInfo/cursor_symbol_graph.swift @@ -182,6 +182,15 @@ enum MyEnum { // CHECKY: "symbols": [ // CHECKY: { // CHECKY: "accessLevel": "private", +// CHECKY: "declarationFragments": [ +// CHECKY: { +// CHECKY: "kind": "keyword", +// CHECKY: "spelling": "private" +// CHECKY: }, +// CHECKY: { +// CHECKY: "kind": "text", +// CHECKY: "spelling": " " +// CHECKY: }, // CHECKY: { // CHECKY: "kind": "keyword", // CHECKY: "spelling": "var" diff --git a/test/SourceKit/CursorInfo/cursor_symbol_graph_referenced.swift b/test/SourceKit/CursorInfo/cursor_symbol_graph_referenced.swift index 1754032227536..5cfe3805389b3 100644 --- a/test/SourceKit/CursorInfo/cursor_symbol_graph_referenced.swift +++ b/test/SourceKit/CursorInfo/cursor_symbol_graph_referenced.swift @@ -237,6 +237,14 @@ extension Parent { // PRIVATE: "declarationFragments": [ // PRIVATE-NEXT: { // PRIVATE-NEXT: "kind": "keyword", +// PRIVATE-NEXT: "spelling": "private" +// PRIVATE-NEXT: }, +// PRIVATE-NEXT: { +// PRIVATE-NEXT: "kind": "text", +// PRIVATE-NEXT: "spelling": " " +// PRIVATE-NEXT: }, +// PRIVATE-NEXT: { +// PRIVATE-NEXT: "kind": "keyword", // PRIVATE-NEXT: "spelling": "func" // PRIVATE-NEXT: }, // PRIVATE-NEXT: { @@ -294,6 +302,14 @@ extension Parent { // SPI: "declarationFragments": [ // SPI-NEXT: { // SPI-NEXT: "kind": "keyword", +// SPI-NEXT: "spelling": "internal" +// SPI-NEXT: }, +// SPI-NEXT: { +// SPI-NEXT: "kind": "text", +// SPI-NEXT: "spelling": " " +// SPI-NEXT: }, +// SPI-NEXT: { +// SPI-NEXT: "kind": "keyword", // SPI-NEXT: "spelling": "func" // SPI-NEXT: }, // SPI-NEXT: { diff --git a/test/SymbolGraph/ClangImporter/EmitWhileBuilding.swift b/test/SymbolGraph/ClangImporter/EmitWhileBuilding.swift deleted file mode 100644 index 7c39f50551537..0000000000000 --- a/test/SymbolGraph/ClangImporter/EmitWhileBuilding.swift +++ /dev/null @@ -1,30 +0,0 @@ -// RUN: %empty-directory(%t) -// RUN: cp -r %S/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework %t -// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -emit-module-path %t/EmitWhileBuilding.framework/Modules/EmitWhileBuilding.swiftmodule/%target-swiftmodule-name -import-underlying-module -F %t -module-name EmitWhileBuilding -disable-objc-attr-requires-foundation-module %s %S/Inputs/EmitWhileBuilding/Extra.swift -emit-symbol-graph -emit-symbol-graph-dir %t -// RUN: %{python} -m json.tool %t/EmitWhileBuilding.symbols.json %t/EmitWhileBuilding.formatted.symbols.json -// RUN: %FileCheck %s --input-file %t/EmitWhileBuilding.formatted.symbols.json -// RUN: %FileCheck %s --input-file %t/EmitWhileBuilding.formatted.symbols.json --check-prefix HEADER - -// REQUIRES: objc_interop - -import Foundation - -public enum SwiftEnum {} - -// HEADER: "precise": "c:@testVariable" - -// CHECK: "precise": "s:17EmitWhileBuilding9SwiftEnumO", -// CHECK: "declarationFragments": [ -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "keyword", -// CHECK-NEXT: "spelling": "enum" -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "text", -// CHECK-NEXT: "spelling": " " -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "identifier", -// CHECK-NEXT: "spelling": "SwiftEnum" -// CHECK-NEXT: } -// CHECK-NEXT: ], diff --git a/test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/Headers/EmitWhileBuilding.h b/test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/Headers/EmitWhileBuilding.h deleted file mode 100644 index 97e9757f4261b..0000000000000 --- a/test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/Headers/EmitWhileBuilding.h +++ /dev/null @@ -1 +0,0 @@ -double testVariable = 1.0; diff --git a/test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/Modules/EmitWhileBuilding.swiftmodule/.keep b/test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/Modules/EmitWhileBuilding.swiftmodule/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/ObjcProperty b/test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/ObjcProperty deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/module.map b/test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/module.map deleted file mode 100644 index 11f3b12d04e5a..0000000000000 --- a/test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/EmitWhileBuilding.framework/module.map +++ /dev/null @@ -1,4 +0,0 @@ -framework module EmitWhileBuilding { - header "EmitWhileBuilding.h" - export * -} diff --git a/test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/Extra.swift b/test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/Extra.swift deleted file mode 100644 index 7a0e59c907c0b..0000000000000 --- a/test/SymbolGraph/ClangImporter/Inputs/EmitWhileBuilding/Extra.swift +++ /dev/null @@ -1 +0,0 @@ -public struct SomeStruct {}