[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
This commit is contained in:
Alex Lorenz
2022-01-20 11:31:58 -08:00
parent 7aa1cd166e
commit e106551028
19 changed files with 35 additions and 35 deletions

View File

@@ -75,7 +75,7 @@ D: Debug info
N: Jordan Rose N: Jordan Rose
E: jordan_rose@apple.com E: jordan_rose@apple.com
G: jrose-apple G: jrose-apple
D: ClangImporter, Serialization, PrintAsObjC, Driver, Frontend D: ClangImporter, Serialization, PrintAsClang, Driver, Frontend
N: Daniel Steffen N: Daniel Steffen
E: dsteffen@apple.com E: dsteffen@apple.com

View File

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

View File

@@ -33,7 +33,7 @@
/// process does not necessarily converge to the canonical type, however. /// process does not necessarily converge to the canonical type, however.
/// The default behavior is TYPE(id, parent). /// The default behavior is TYPE(id, parent).
// //
// If you add a new sugared type, be sure to test it in PrintAsObjC! // If you add a new sugared type, be sure to test it in PrintAsClang!
/// UNCHECKED_TYPE(id, parent) /// UNCHECKED_TYPE(id, parent)
/// This type is not present in valid, type-checked programs. /// This type is not present in valid, type-checked programs.

View File

@@ -1,4 +1,4 @@
//===--- PrintAsObjC.h - Emit a header file for a Swift AST -----*- C++ -*-===// //===--- PrintAsClang.h - Emit a header file for a Swift AST ----*- C++ -*-===//
// //
// This source file is part of the Swift.org open source project // This source file is part of the Swift.org open source project
// //
@@ -10,8 +10,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef SWIFT_PRINTASOBJC_H #ifndef SWIFT_PRINTASCLANG_H
#define SWIFT_PRINTASOBJC_H #define SWIFT_PRINTASCLANG_H
#include "swift/Basic/LLVM.h" #include "swift/Basic/LLVM.h"
#include "swift/AST/AttrKind.h" #include "swift/AST/AttrKind.h"

View File

@@ -64,7 +64,7 @@ getErrorDomainStringForObjC(const EnumDecl *ED) {
for (const NominalTypeDecl * D = ED; for (const NominalTypeDecl * D = ED;
D != nullptr; D != nullptr;
D = D->getDeclContext()->getSelfNominalTypeDecl()) { D = D->getDeclContext()->getSelfNominalTypeDecl()) {
// We don't currently PrintAsObjC any types whose parents are private or // We don't currently PrintAsClang any types whose parents are private or
// fileprivate. // fileprivate.
assert(D->getFormalAccess() >= AccessLevel::Internal && assert(D->getFormalAccess() >= AccessLevel::Internal &&
"We don't currently append private discriminators"); "We don't currently append private discriminators");

View File

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

View File

@@ -35,7 +35,7 @@ add_subdirectory(Markup)
add_subdirectory(Migrator) add_subdirectory(Migrator)
add_subdirectory(Option) add_subdirectory(Option)
add_subdirectory(Parse) add_subdirectory(Parse)
add_subdirectory(PrintAsObjC) add_subdirectory(PrintAsClang)
add_subdirectory(RemoteAST) add_subdirectory(RemoteAST)
add_subdirectory(Sema) add_subdirectory(Sema)
add_subdirectory(Serialization) add_subdirectory(Serialization)

View File

@@ -3093,7 +3093,7 @@ namespace {
if (!result) if (!result)
return nullptr; return nullptr;
// HACK: Make sure PrintAsObjC always omits the 'enum' tag for // HACK: Make sure PrintAsClang always omits the 'enum' tag for
// option set enums. // option set enums.
Impl.DeclsWithSuperfluousTypedefs.insert(decl); Impl.DeclsWithSuperfluousTypedefs.insert(decl);
break; break;

View File

@@ -21,7 +21,7 @@ target_link_libraries(swiftFrontendTool PRIVATE
swiftIndex swiftIndex
swiftIRGen swiftIRGen
swiftOption swiftOption
swiftPrintAsObjC swiftPrintAsClang
swiftSerialization swiftSerialization
swiftSIL swiftSIL
swiftSILGen swiftSILGen

View File

@@ -62,7 +62,7 @@
#include "swift/Option/Options.h" #include "swift/Option/Options.h"
#include "swift/Migrator/FixitFilter.h" #include "swift/Migrator/FixitFilter.h"
#include "swift/Migrator/Migrator.h" #include "swift/Migrator/Migrator.h"
#include "swift/PrintAsObjC/PrintAsObjC.h" #include "swift/PrintAsClang/PrintAsClang.h"
#include "swift/Serialization/SerializationOptions.h" #include "swift/Serialization/SerializationOptions.h"
#include "swift/Serialization/SerializedModuleLoader.h" #include "swift/Serialization/SerializedModuleLoader.h"
#include "swift/SILOptimizer/PassManager/Passes.h" #include "swift/SILOptimizer/PassManager/Passes.h"

View File

@@ -0,0 +1,12 @@
add_swift_host_library(swiftPrintAsClang STATIC
DeclAndTypePrinter.cpp
ModuleContentsWriter.cpp
PrintAsClang.cpp)
target_link_libraries(swiftPrintAsClang PRIVATE
swiftAST
swiftClangImporter
swiftFrontend
swiftIDE)
set_swift_llvm_is_available(swiftPrintAsClang)

View File

@@ -10,8 +10,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef SWIFT_PRINTASOBJC_DECLANDTYPEPRINTER_H #ifndef SWIFT_PRINTASCLANG_DECLANDTYPEPRINTER_H
#define SWIFT_PRINTASOBJC_DECLANDTYPEPRINTER_H #define SWIFT_PRINTASCLANG_DECLANDTYPEPRINTER_H
#include "swift/AST/Type.h" #include "swift/AST/Type.h"
// for OptionalTypeKind // for OptionalTypeKind

View File

@@ -10,8 +10,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef SWIFT_PRINTASOBJC_MODULECONTENTSWRITER_H #ifndef SWIFT_PRINTASCLANG_MODULECONTENTSWRITER_H
#define SWIFT_PRINTASOBJC_MODULECONTENTSWRITER_H #define SWIFT_PRINTASCLANG_MODULECONTENTSWRITER_H
#include "swift/AST/AttrKind.h" #include "swift/AST/AttrKind.h"
#include "swift/Basic/LLVM.h" #include "swift/Basic/LLVM.h"

View File

@@ -1,4 +1,4 @@
//===--- PrintAsObjC.cpp - Emit a header file for a Swift AST -------------===// //===--- PrintAsClang.cpp - Emit a header file for a Swift AST ------------===//
// //
// This source file is part of the Swift.org open source project // This source file is part of the Swift.org open source project
// //
@@ -10,7 +10,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "swift/PrintAsObjC/PrintAsObjC.h" #include "swift/PrintAsClang/PrintAsClang.h"
#include "ModuleContentsWriter.h" #include "ModuleContentsWriter.h"

View File

@@ -1,12 +0,0 @@
add_swift_host_library(swiftPrintAsObjC STATIC
DeclAndTypePrinter.cpp
ModuleContentsWriter.cpp
PrintAsObjC.cpp)
target_link_libraries(swiftPrintAsObjC PRIVATE
swiftAST
swiftClangImporter
swiftFrontend
swiftIDE)
set_swift_llvm_is_available(swiftPrintAsObjC)

View File

@@ -119,7 +119,7 @@ ValueDecl *DerivedConformance::deriveBridgedNSError(ValueDecl *requirement) {
auto scope = Nominal->getFormalAccessScope(Nominal->getModuleScopeContext()); auto scope = Nominal->getFormalAccessScope(Nominal->getModuleScopeContext());
if (scope.isPublic() || scope.isInternal()) if (scope.isPublic() || scope.isInternal())
// PrintAsObjC may print this domain, so we should make sure we use the // PrintAsClang may print this domain, so we should make sure we use the
// same string it will. // same string it will.
synthesizer = deriveBodyBridgedNSError_printAsObjCEnum_nsErrorDomain; synthesizer = deriveBodyBridgedNSError_printAsObjCEnum_nsErrorDomain;

View File

@@ -299,7 +299,7 @@ static void diagnoseFunctionParamNotRepresentable(
static bool isParamListRepresentableInObjC(const AbstractFunctionDecl *AFD, static bool isParamListRepresentableInObjC(const AbstractFunctionDecl *AFD,
const ParameterList *PL, const ParameterList *PL,
ObjCReason Reason) { ObjCReason Reason) {
// If you change this function, you must add or modify a test in PrintAsObjC. // If you change this function, you must add or modify a test in PrintAsClang.
ASTContext &ctx = AFD->getASTContext(); ASTContext &ctx = AFD->getASTContext();
auto &diags = ctx.Diags; auto &diags = ctx.Diags;
auto behavior = behaviorLimitForObjCReason(Reason, ctx); auto behavior = behaviorLimitForObjCReason(Reason, ctx);
@@ -598,7 +598,7 @@ bool swift::isRepresentableInObjC(
asyncConvention = None; asyncConvention = None;
errorConvention = None; errorConvention = None;
// If you change this function, you must add or modify a test in PrintAsObjC. // If you change this function, you must add or modify a test in PrintAsClang.
ASTContext &ctx = AFD->getASTContext(); ASTContext &ctx = AFD->getASTContext();
DiagnosticStateRAII diagState(ctx.Diags); DiagnosticStateRAII diagState(ctx.Diags);
@@ -1025,7 +1025,7 @@ bool swift::isRepresentableInObjC(
} }
bool swift::isRepresentableInObjC(const VarDecl *VD, ObjCReason Reason) { bool swift::isRepresentableInObjC(const VarDecl *VD, ObjCReason Reason) {
// If you change this function, you must add or modify a test in PrintAsObjC. // If you change this function, you must add or modify a test in PrintAsClang.
if (VD->isInvalid()) if (VD->isInvalid())
return false; return false;
@@ -1085,7 +1085,7 @@ bool swift::isRepresentableInObjC(const VarDecl *VD, ObjCReason Reason) {
} }
bool swift::isRepresentableInObjC(const SubscriptDecl *SD, ObjCReason Reason) { bool swift::isRepresentableInObjC(const SubscriptDecl *SD, ObjCReason Reason) {
// If you change this function, you must add or modify a test in PrintAsObjC. // If you change this function, you must add or modify a test in PrintAsClang.
ASTContext &ctx = SD->getASTContext(); ASTContext &ctx = SD->getASTContext();
DiagnosticStateRAII diagState(ctx.Diags); DiagnosticStateRAII diagState(ctx.Diags);
auto behavior = behaviorLimitForObjCReason(Reason, ctx); auto behavior = behaviorLimitForObjCReason(Reason, ctx);