Skip to content

Commit aa72ea8

Browse files
committed
Run clang-format on the Print Availability and its related methods
1 parent 4f88e31 commit aa72ea8

File tree

1 file changed

+66
-66
lines changed

1 file changed

+66
-66
lines changed

lib/PrintAsObjC/PrintAsObjC.cpp

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -774,17 +774,17 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
774774
No = false,
775775
Yes = true
776776
};
777-
778-
/// Returns \c true if anything was printed.
777+
778+
/// Returns \c true if anything was printed.
779779
bool printAvailability(const Decl *D, PrintLeadingSpace printLeadingSpace =
780-
PrintLeadingSpace::Yes) {
780+
PrintLeadingSpace::Yes) {
781781
bool hasPrintedAnything = false;
782782
auto maybePrintLeadingSpace = [&] {
783783
if (printLeadingSpace == PrintLeadingSpace::Yes || hasPrintedAnything)
784784
os << " ";
785785
hasPrintedAnything = true;
786786
};
787-
787+
788788
for (auto AvAttr : D->getAttrs().getAttributes<AvailableAttr>()) {
789789
if (AvAttr->Platform == PlatformKind::none) {
790790
if (AvAttr->PlatformAgnostic ==
@@ -794,8 +794,8 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
794794
// rename
795795
maybePrintLeadingSpace();
796796
os << "SWIFT_UNAVAILABLE_MSG(\"'"
797-
<< cast<ValueDecl>(D)->getBaseName()
798-
<< "' has been renamed to '";
797+
<< cast<ValueDecl>(D)->getBaseName()
798+
<< "' has been renamed to '";
799799
printRenameForDecl(AvAttr, cast<ValueDecl>(D), false);
800800
os << '\'';
801801
if (!AvAttr->Message.empty()) {
@@ -831,45 +831,45 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
831831
}
832832
continue;
833833
}
834-
834+
835835
// Availability for a specific platform
836836
if (!AvAttr->Introduced.hasValue() && !AvAttr->Deprecated.hasValue() &&
837837
!AvAttr->Obsoleted.hasValue() &&
838838
!AvAttr->isUnconditionallyDeprecated() &&
839839
!AvAttr->isUnconditionallyUnavailable()) {
840840
continue;
841841
}
842-
842+
843843
const char *plat;
844844
switch (AvAttr->Platform) {
845-
case PlatformKind::OSX:
846-
plat = "macos";
847-
break;
848-
case PlatformKind::iOS:
849-
plat = "ios";
850-
break;
851-
case PlatformKind::tvOS:
852-
plat = "tvos";
853-
break;
854-
case PlatformKind::watchOS:
855-
plat = "watchos";
856-
break;
857-
case PlatformKind::OSXApplicationExtension:
858-
plat = "macos_app_extension";
859-
break;
860-
case PlatformKind::iOSApplicationExtension:
861-
plat = "ios_app_extension";
862-
break;
863-
case PlatformKind::tvOSApplicationExtension:
864-
plat = "tvos_app_extension";
865-
break;
866-
case PlatformKind::watchOSApplicationExtension:
867-
plat = "watchos_app_extension";
868-
break;
869-
case PlatformKind::none:
870-
llvm_unreachable("handled above");
845+
case PlatformKind::OSX:
846+
plat = "macos";
847+
break;
848+
case PlatformKind::iOS:
849+
plat = "ios";
850+
break;
851+
case PlatformKind::tvOS:
852+
plat = "tvos";
853+
break;
854+
case PlatformKind::watchOS:
855+
plat = "watchos";
856+
break;
857+
case PlatformKind::OSXApplicationExtension:
858+
plat = "macos_app_extension";
859+
break;
860+
case PlatformKind::iOSApplicationExtension:
861+
plat = "ios_app_extension";
862+
break;
863+
case PlatformKind::tvOSApplicationExtension:
864+
plat = "tvos_app_extension";
865+
break;
866+
case PlatformKind::watchOSApplicationExtension:
867+
plat = "watchos_app_extension";
868+
break;
869+
case PlatformKind::none:
870+
llvm_unreachable("handled above");
871871
}
872-
872+
873873
maybePrintLeadingSpace();
874874
os << "SWIFT_AVAILABILITY(" << plat;
875875
if (AvAttr->isUnconditionallyUnavailable()) {
@@ -895,7 +895,7 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
895895
}
896896
if (!AvAttr->Rename.empty() && isa<ValueDecl>(D)) {
897897
os << ",message=\"'" << cast<ValueDecl>(D)->getBaseName()
898-
<< "' has been renamed to '";
898+
<< "' has been renamed to '";
899899
printRenameForDecl(AvAttr, cast<ValueDecl>(D), false);
900900
os << '\'';
901901
if (!AvAttr->Message.empty()) {
@@ -911,13 +911,13 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
911911
}
912912
return hasPrintedAnything;
913913
}
914-
914+
915915
const ValueDecl *getRenameDecl(const ValueDecl *D,
916916
const ParsedDeclName renamedParsedDeclName) {
917917
auto declContext = D->getDeclContext();
918918
ASTContext &astContext = D->getASTContext();
919919
auto renamedDeclName = renamedParsedDeclName.formDeclName(astContext);
920-
920+
921921
if (isa<ClassDecl>(D) || isa<ProtocolDecl>(D)) {
922922
UnqualifiedLookup lookup(renamedDeclName.getBaseIdentifier(),
923923
declContext->getModuleScopeContext(), nullptr,
@@ -926,54 +926,54 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
926926
return lookup.getSingleTypeResult();
927927
} else {
928928
TypeDecl *typeDecl = declContext->getSelfNominalTypeDecl();
929-
929+
930930
if (!renamedParsedDeclName.ContextName.empty()) {
931931
auto contextIdentifier =
932-
astContext.getIdentifier(renamedParsedDeclName.ContextName);
932+
astContext.getIdentifier(renamedParsedDeclName.ContextName);
933933
UnqualifiedLookup specificTypeLookup(
934-
contextIdentifier, declContext->getModuleScopeContext(), nullptr,
935-
SourceLoc(), UnqualifiedLookup::Flags::TypeLookup);
934+
contextIdentifier, declContext->getModuleScopeContext(), nullptr,
935+
SourceLoc(), UnqualifiedLookup::Flags::TypeLookup);
936936
if (!specificTypeLookup.getSingleTypeResult()) {
937937
return nullptr;
938938
}
939-
939+
940940
if (typeDecl->getDeclaredInterfaceType()->matches(
941-
specificTypeLookup.getSingleTypeResult()
942-
->getDeclaredInterfaceType(),
943-
TypeMatchFlags::AllowOverride)) {
941+
specificTypeLookup.getSingleTypeResult()
942+
->getDeclaredInterfaceType(),
943+
TypeMatchFlags::AllowOverride)) {
944944
// If the Context Name contain the name of the subclass then we would
945945
// find the renamed in the superclass instead
946946
typeDecl = specificTypeLookup.getSingleTypeResult();
947947
} else if (!specificTypeLookup.getSingleTypeResult()
948-
->getDeclaredInterfaceType()
949-
->matches(typeDecl->getDeclaredInterfaceType(),
950-
TypeMatchFlags::AllowOverride)) {
951-
// Failed and print the raw renamed attributed when there is no
952-
// relationship between those 2 types
953-
return nullptr;
954-
}
948+
->getDeclaredInterfaceType()
949+
->matches(typeDecl->getDeclaredInterfaceType(),
950+
TypeMatchFlags::AllowOverride)) {
951+
// Failed and print the raw renamed attributed when there is no
952+
// relationship between those 2 types
953+
return nullptr;
954+
}
955955
}
956-
956+
957957
const ValueDecl *renamedDecl = nullptr;
958958
SmallVector<ValueDecl *, 4> lookupResults;
959959
declContext->lookupQualified(typeDecl, renamedDeclName,
960960
NL_QualifiedDefault, lookupResults);
961961
for (auto candidate : lookupResults) {
962962
if (!shouldInclude(candidate))
963963
continue;
964-
964+
965965
if (candidate->getKind() != D->getKind() ||
966966
(candidate->isInstanceMember() !=
967967
cast<ValueDecl>(D)->isInstanceMember()))
968968
continue;
969-
969+
970970
if (isa<FuncDecl>(candidate)) {
971971
auto cParams = cast<FuncDecl>(candidate)->getParameters();
972972
auto dParams = cast<FuncDecl>(D)->getParameters();
973-
973+
974974
if (cParams->size() != dParams->size())
975975
continue;
976-
976+
977977
bool hasSameParameterTypes = true;
978978
for (auto index : indices(*cParams)) {
979979
auto cParamsType = cParams->get(index)->getType();
@@ -984,12 +984,12 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
984984
break;
985985
}
986986
}
987-
987+
988988
if (!hasSameParameterTypes) {
989989
continue;
990990
}
991991
}
992-
992+
993993
if (renamedDecl) {
994994
// If we found a duplicated candidate then we would silently fail.
995995
renamedDecl = nullptr;
@@ -1000,24 +1000,24 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
10001000
return renamedDecl;
10011001
}
10021002
}
1003-
1003+
10041004
void printRenameForDecl(const AvailableAttr *AvAttr, const ValueDecl *D,
10051005
bool includeQuotes) {
10061006
assert(!AvAttr->Rename.empty());
1007-
1007+
10081008
const swift::ValueDecl *renamedDecl =
1009-
getRenameDecl(D, parseDeclName(AvAttr->Rename));
1010-
1009+
getRenameDecl(D, parseDeclName(AvAttr->Rename));
1010+
10111011
if (renamedDecl) {
10121012
SmallString<128> scratch;
10131013
auto renamedObjCRuntimeName =
1014-
renamedDecl->getObjCRuntimeName()->getString(scratch);
1014+
renamedDecl->getObjCRuntimeName()->getString(scratch);
10151015
printEncodedString(renamedObjCRuntimeName, includeQuotes);
10161016
} else {
10171017
printEncodedString(AvAttr->Rename, includeQuotes);
10181018
}
10191019
}
1020-
1020+
10211021
void printSwift3ObjCDeprecatedInference(ValueDecl *VD) {
10221022
const LangOptions &langOpts = M.getASTContext().LangOpts;
10231023
if (!langOpts.EnableSwift3ObjCInference ||

0 commit comments

Comments
 (0)