Skip to content

Commit e106551

Browse files
committedJan 20, 2022
[NFC][interop] rename the PrintAsObjC library to PrintAsClang
We're starting to support emission of C++ header interfaces, so a language-agnostic name makes more sense
1 parent 7aa1cd1 commit e106551

19 files changed

+35
-35
lines changed
 

‎CODE_OWNERS.TXT

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ D: Debug info
7575
N: Jordan Rose
7676
E: jordan_rose@apple.com
7777
G: jrose-apple
78-
D: ClangImporter, Serialization, PrintAsObjC, Driver, Frontend
78+
D: ClangImporter, Serialization, PrintAsClang, Driver, Frontend
7979

8080
N: Daniel Steffen
8181
E: dsteffen@apple.com

‎docs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ documentation, please create a thread on the Swift forums under the
102102
- [DependencyAnalysis.md](/docs/DependencyAnalysis.md):
103103
Describes different kinds of dependencies across files in the same module,
104104
important for understanding incremental builds.
105-
- C and ObjC interoperability: Clang Importer and PrintAsObjC
105+
- C and ObjC interoperability: Clang Importer and PrintAsClang
106106
- [CToSwiftNameTranslation.md](/docs/CToSwiftNameTranslation.md):
107107
Describes how C and ObjC entities are imported into Swift
108108
by the Clang Importer.

‎include/swift/AST/TypeNodes.def

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/// process does not necessarily converge to the canonical type, however.
3434
/// The default behavior is TYPE(id, parent).
3535
//
36-
// If you add a new sugared type, be sure to test it in PrintAsObjC!
36+
// If you add a new sugared type, be sure to test it in PrintAsClang!
3737

3838
/// UNCHECKED_TYPE(id, parent)
3939
/// This type is not present in valid, type-checked programs.

‎include/swift/PrintAsObjC/PrintAsObjC.h renamed to ‎include/swift/PrintAsClang/PrintAsClang.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- PrintAsObjC.h - Emit a header file for a Swift AST -----*- C++ -*-===//
1+
//===--- PrintAsClang.h - Emit a header file for a Swift AST ----*- C++ -*-===//
22
//
33
// This source file is part of the Swift.org open source project
44
//
@@ -10,8 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#ifndef SWIFT_PRINTASOBJC_H
14-
#define SWIFT_PRINTASOBJC_H
13+
#ifndef SWIFT_PRINTASCLANG_H
14+
#define SWIFT_PRINTASCLANG_H
1515

1616
#include "swift/Basic/LLVM.h"
1717
#include "swift/AST/AttrKind.h"

‎lib/AST/SwiftNameTranslation.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ getErrorDomainStringForObjC(const EnumDecl *ED) {
6464
for (const NominalTypeDecl * D = ED;
6565
D != nullptr;
6666
D = D->getDeclContext()->getSelfNominalTypeDecl()) {
67-
// We don't currently PrintAsObjC any types whose parents are private or
67+
// We don't currently PrintAsClang any types whose parents are private or
6868
// fileprivate.
6969
assert(D->getFormalAccess() >= AccessLevel::Internal &&
7070
"We don't currently append private discriminators");

‎lib/AST/Type.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2630,7 +2630,7 @@ getObjCObjectRepresentable(Type type, const DeclContext *dc) {
26302630
///
26312631
/// This function determines when and how a particular type is mapped
26322632
/// into a foreign language. Any changes to the logic here also need
2633-
/// to be reflected in PrintAsObjC, so that the Swift type will be
2633+
/// to be reflected in PrintAsClang, so that the Swift type will be
26342634
/// properly printed for (Objective-)C and in SIL's bridging logic.
26352635
static std::pair<ForeignRepresentableKind, ProtocolConformance *>
26362636
getForeignRepresentable(Type type, ForeignLanguage language,

‎lib/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ add_subdirectory(Markup)
3535
add_subdirectory(Migrator)
3636
add_subdirectory(Option)
3737
add_subdirectory(Parse)
38-
add_subdirectory(PrintAsObjC)
38+
add_subdirectory(PrintAsClang)
3939
add_subdirectory(RemoteAST)
4040
add_subdirectory(Sema)
4141
add_subdirectory(Serialization)

‎lib/ClangImporter/ImportDecl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3093,7 +3093,7 @@ namespace {
30933093
if (!result)
30943094
return nullptr;
30953095

3096-
// HACK: Make sure PrintAsObjC always omits the 'enum' tag for
3096+
// HACK: Make sure PrintAsClang always omits the 'enum' tag for
30973097
// option set enums.
30983098
Impl.DeclsWithSuperfluousTypedefs.insert(decl);
30993099
break;

‎lib/FrontendTool/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ target_link_libraries(swiftFrontendTool PRIVATE
2121
swiftIndex
2222
swiftIRGen
2323
swiftOption
24-
swiftPrintAsObjC
24+
swiftPrintAsClang
2525
swiftSerialization
2626
swiftSIL
2727
swiftSILGen

‎lib/FrontendTool/FrontendTool.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
#include "swift/Option/Options.h"
6363
#include "swift/Migrator/FixitFilter.h"
6464
#include "swift/Migrator/Migrator.h"
65-
#include "swift/PrintAsObjC/PrintAsObjC.h"
65+
#include "swift/PrintAsClang/PrintAsClang.h"
6666
#include "swift/Serialization/SerializationOptions.h"
6767
#include "swift/Serialization/SerializedModuleLoader.h"
6868
#include "swift/SILOptimizer/PassManager/Passes.h"

‎lib/PrintAsClang/CMakeLists.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
add_swift_host_library(swiftPrintAsClang STATIC
3+
DeclAndTypePrinter.cpp
4+
ModuleContentsWriter.cpp
5+
PrintAsClang.cpp)
6+
target_link_libraries(swiftPrintAsClang PRIVATE
7+
swiftAST
8+
swiftClangImporter
9+
swiftFrontend
10+
swiftIDE)
11+
12+
set_swift_llvm_is_available(swiftPrintAsClang)

‎lib/PrintAsObjC/DeclAndTypePrinter.h renamed to ‎lib/PrintAsClang/DeclAndTypePrinter.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#ifndef SWIFT_PRINTASOBJC_DECLANDTYPEPRINTER_H
14-
#define SWIFT_PRINTASOBJC_DECLANDTYPEPRINTER_H
13+
#ifndef SWIFT_PRINTASCLANG_DECLANDTYPEPRINTER_H
14+
#define SWIFT_PRINTASCLANG_DECLANDTYPEPRINTER_H
1515

1616
#include "swift/AST/Type.h"
1717
// for OptionalTypeKind

‎lib/PrintAsObjC/ModuleContentsWriter.h renamed to ‎lib/PrintAsClang/ModuleContentsWriter.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#ifndef SWIFT_PRINTASOBJC_MODULECONTENTSWRITER_H
14-
#define SWIFT_PRINTASOBJC_MODULECONTENTSWRITER_H
13+
#ifndef SWIFT_PRINTASCLANG_MODULECONTENTSWRITER_H
14+
#define SWIFT_PRINTASCLANG_MODULECONTENTSWRITER_H
1515

1616
#include "swift/AST/AttrKind.h"
1717
#include "swift/Basic/LLVM.h"

‎lib/PrintAsObjC/PrintAsObjC.cpp renamed to ‎lib/PrintAsClang/PrintAsClang.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- PrintAsObjC.cpp - Emit a header file for a Swift AST -------------===//
1+
//===--- PrintAsClang.cpp - Emit a header file for a Swift AST ------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "swift/PrintAsObjC/PrintAsObjC.h"
13+
#include "swift/PrintAsClang/PrintAsClang.h"
1414

1515
#include "ModuleContentsWriter.h"
1616

‎lib/PrintAsObjC/CMakeLists.txt

-12
This file was deleted.

‎lib/Sema/DerivedConformanceError.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ ValueDecl *DerivedConformance::deriveBridgedNSError(ValueDecl *requirement) {
119119

120120
auto scope = Nominal->getFormalAccessScope(Nominal->getModuleScopeContext());
121121
if (scope.isPublic() || scope.isInternal())
122-
// PrintAsObjC may print this domain, so we should make sure we use the
122+
// PrintAsClang may print this domain, so we should make sure we use the
123123
// same string it will.
124124
synthesizer = deriveBodyBridgedNSError_printAsObjCEnum_nsErrorDomain;
125125

‎lib/Sema/TypeCheckDeclObjC.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ static void diagnoseFunctionParamNotRepresentable(
299299
static bool isParamListRepresentableInObjC(const AbstractFunctionDecl *AFD,
300300
const ParameterList *PL,
301301
ObjCReason Reason) {
302-
// If you change this function, you must add or modify a test in PrintAsObjC.
302+
// If you change this function, you must add or modify a test in PrintAsClang.
303303
ASTContext &ctx = AFD->getASTContext();
304304
auto &diags = ctx.Diags;
305305
auto behavior = behaviorLimitForObjCReason(Reason, ctx);
@@ -598,7 +598,7 @@ bool swift::isRepresentableInObjC(
598598
asyncConvention = None;
599599
errorConvention = None;
600600

601-
// If you change this function, you must add or modify a test in PrintAsObjC.
601+
// If you change this function, you must add or modify a test in PrintAsClang.
602602
ASTContext &ctx = AFD->getASTContext();
603603
DiagnosticStateRAII diagState(ctx.Diags);
604604

@@ -1025,7 +1025,7 @@ bool swift::isRepresentableInObjC(
10251025
}
10261026

10271027
bool swift::isRepresentableInObjC(const VarDecl *VD, ObjCReason Reason) {
1028-
// If you change this function, you must add or modify a test in PrintAsObjC.
1028+
// If you change this function, you must add or modify a test in PrintAsClang.
10291029

10301030
if (VD->isInvalid())
10311031
return false;
@@ -1085,7 +1085,7 @@ bool swift::isRepresentableInObjC(const VarDecl *VD, ObjCReason Reason) {
10851085
}
10861086

10871087
bool swift::isRepresentableInObjC(const SubscriptDecl *SD, ObjCReason Reason) {
1088-
// If you change this function, you must add or modify a test in PrintAsObjC.
1088+
// If you change this function, you must add or modify a test in PrintAsClang.
10891089
ASTContext &ctx = SD->getASTContext();
10901090
DiagnosticStateRAII diagState(ctx.Diags);
10911091
auto behavior = behaviorLimitForObjCReason(Reason, ctx);

0 commit comments

Comments
 (0)