Skip to content

Commit b875b97

Browse files
authored
Revert "Symbol graph support"
1 parent 22bfebe commit b875b97

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+43
-2574
lines changed

include/swift/AST/Decl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,8 +875,6 @@ class alignas(1 << DeclAlignInBits) Decl {
875875
LLVM_READONLY
876876
const GenericContext *getAsGenericContext() const;
877877

878-
bool hasUnderscoredNaming() const;
879-
880878
bool isPrivateStdlibDecl(bool treatNonBuiltinProtocolsAsPublic = true) const;
881879

882880
AvailabilityContext getAvailabilityForLinkage() const;

include/swift/AST/PrintOptions.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,6 @@ struct PrintOptions {
380380
ArgAndParamPrintingMode ArgAndParamPrinting =
381381
ArgAndParamPrintingMode::MatchSource;
382382

383-
/// Whether to print the default argument value string
384-
/// representation.
385-
bool PrintDefaultArgumentValue = true;
386-
387-
/// Whether to print "_" placeholders for empty arguments.
388-
bool PrintEmptyArgumentNames = true;
389-
390383
/// Whether to print documentation comments attached to declarations.
391384
/// Note that this may print documentation comments from related declarations
392385
/// (e.g. the overridden method in the superclass) if such comment is found.

include/swift/Driver/Driver.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ class Driver {
158158
Interactive, // swift
159159
Batch, // swiftc
160160
AutolinkExtract, // swift-autolink-extract
161-
SwiftIndent, // swift-indent
162-
SymbolGraph // swift-symbolgraph
161+
SwiftIndent // swift-indent
163162
};
164163

165164
class InputInfoMap;

include/swift/SymbolGraphGen/SymbolGraphGen.h

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

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,9 +2632,6 @@ void PrintAST::printOneParameter(const ParamDecl *param,
26322632
// Else, print the argument only.
26332633
LLVM_FALLTHROUGH;
26342634
case PrintOptions::ArgAndParamPrintingMode::ArgumentOnly:
2635-
if (ArgName.empty() && !Options.PrintEmptyArgumentNames) {
2636-
return;
2637-
}
26382635
Printer.printName(ArgName, PrintNameContext::FunctionParameterExternal);
26392636

26402637
if (!ArgNameIsAPIByDefault && !ArgName.empty())
@@ -2689,7 +2686,7 @@ void PrintAST::printOneParameter(const ParamDecl *param,
26892686
if (param->isVariadic())
26902687
Printer << "...";
26912688

2692-
if (param->isDefaultArgument() && Options.PrintDefaultArgumentValue) {
2689+
if (param->isDefaultArgument()) {
26932690
SmallString<128> scratch;
26942691
auto defaultArgStr = param->getDefaultValueStringRepresentation(scratch);
26952692

lib/AST/Decl.cpp

Lines changed: 36 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -697,56 +697,6 @@ bool ParameterList::hasInternalParameter(StringRef Prefix) const {
697697
return false;
698698
}
699699

700-
bool Decl::hasUnderscoredNaming() const {
701-
const Decl *D = this;
702-
if (const auto AFD = dyn_cast<AbstractFunctionDecl>(D)) {
703-
// If it's a function with a parameter with leading underscore, it's a
704-
// private function.
705-
if (AFD->getParameters()->hasInternalParameter("_")) {
706-
return true;
707-
}
708-
}
709-
710-
if (const auto SubscriptD = dyn_cast<SubscriptDecl>(D)) {
711-
if (SubscriptD->getIndices()->hasInternalParameter("_")) {
712-
return true;
713-
}
714-
}
715-
716-
if (const auto PD = dyn_cast<ProtocolDecl>(D)) {
717-
if (PD->getAttrs().hasAttribute<ShowInInterfaceAttr>()) {
718-
return false;
719-
}
720-
StringRef NameStr = PD->getNameStr();
721-
if (NameStr.startswith("_Builtin")) {
722-
return true;
723-
}
724-
if (NameStr.startswith("_ExpressibleBy")) {
725-
return true;
726-
}
727-
}
728-
729-
if (const auto ImportD = dyn_cast<ImportDecl>(D)) {
730-
if (const auto *Mod = ImportD->getModule()) {
731-
if (Mod->isSwiftShimsModule()) {
732-
return true;
733-
}
734-
}
735-
}
736-
737-
const auto VD = dyn_cast<ValueDecl>(D);
738-
if (!VD || !VD->hasName()) {
739-
return false;
740-
}
741-
742-
if (!VD->getBaseName().isSpecial() &&
743-
VD->getBaseName().getIdentifier().str().startswith("_")) {
744-
return true;
745-
}
746-
747-
return false;
748-
}
749-
750700
bool Decl::isPrivateStdlibDecl(bool treatNonBuiltinProtocolsAsPublic) const {
751701
const Decl *D = this;
752702
if (auto ExtD = dyn_cast<ExtensionDecl>(D)) {
@@ -768,12 +718,47 @@ bool Decl::isPrivateStdlibDecl(bool treatNonBuiltinProtocolsAsPublic) const {
768718
FU->getKind() != FileUnitKind::SerializedAST)
769719
return false;
770720

721+
if (auto AFD = dyn_cast<AbstractFunctionDecl>(D)) {
722+
// If it's a function with a parameter with leading underscore, it's a
723+
// private function.
724+
if (AFD->getParameters()->hasInternalParameter("_"))
725+
return true;
726+
}
727+
728+
if (auto SubscriptD = dyn_cast<SubscriptDecl>(D)) {
729+
if (SubscriptD->getIndices()->hasInternalParameter("_"))
730+
return true;
731+
}
732+
771733
if (auto PD = dyn_cast<ProtocolDecl>(D)) {
734+
if (PD->getAttrs().hasAttribute<ShowInInterfaceAttr>())
735+
return false;
736+
StringRef NameStr = PD->getNameStr();
737+
if (NameStr.startswith("_Builtin"))
738+
return true;
739+
if (NameStr.startswith("_ExpressibleBy"))
740+
return true;
772741
if (treatNonBuiltinProtocolsAsPublic)
773742
return false;
774743
}
775744

776-
return hasUnderscoredNaming();
745+
if (auto ImportD = dyn_cast<ImportDecl>(D)) {
746+
if (auto *Mod = ImportD->getModule()) {
747+
if (Mod->isSwiftShimsModule())
748+
return true;
749+
}
750+
}
751+
752+
auto VD = dyn_cast<ValueDecl>(D);
753+
if (!VD || !VD->hasName())
754+
return false;
755+
756+
// If the name has leading underscore then it's a private symbol.
757+
if (!VD->getBaseName().isSpecial() &&
758+
VD->getBaseName().getIdentifier().str().startswith("_"))
759+
return true;
760+
761+
return false;
777762
}
778763

779764
AvailabilityContext Decl::getAvailabilityForLinkage() const {

lib/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ add_subdirectory(SwiftRemoteMirror)
4242
add_subdirectory(SIL)
4343
add_subdirectory(SILGen)
4444
add_subdirectory(SILOptimizer)
45-
add_subdirectory(SymbolGraphGen)
4645
add_subdirectory(Syntax)
4746
add_subdirectory(SyntaxParse)
4847
add_subdirectory(TBDGen)

lib/Driver/Driver.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ void Driver::parseDriverKind(ArrayRef<const char *> Args) {
9898
.Case("swiftc", DriverKind::Batch)
9999
.Case("swift-autolink-extract", DriverKind::AutolinkExtract)
100100
.Case("swift-indent", DriverKind::SwiftIndent)
101-
.Case("swift-symbolgraph-extract", DriverKind::SymbolGraph)
102101
.Default(None);
103102

104103
if (Kind.hasValue())
@@ -3253,7 +3252,6 @@ void Driver::printHelp(bool ShowHidden) const {
32533252
case DriverKind::Batch:
32543253
case DriverKind::AutolinkExtract:
32553254
case DriverKind::SwiftIndent:
3256-
case DriverKind::SymbolGraph:
32573255
ExcludedFlagsBitmask |= options::NoBatchOption;
32583256
break;
32593257
}

lib/Markup/LineList.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ LineList MarkupContext::getLineList(swift::RawComment RC) {
115115
// Determine if we have leading decorations in this block comment.
116116
bool HasASCIIArt = false;
117117
if (swift::startsWithNewline(Cleaned)) {
118+
Builder.addLine(Cleaned.substr(0, 0), { C.Range.getStart(),
119+
C.Range.getStart() });
118120
unsigned NewlineBytes = swift::measureNewline(Cleaned);
119121
Cleaned = Cleaned.drop_front(NewlineBytes);
120122
CleanedStartLoc = CleanedStartLoc.getAdvancedLocOrInvalid(NewlineBytes);

lib/SymbolGraphGen/CMakeLists.txt

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

0 commit comments

Comments
 (0)