mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -75,7 +75,7 @@ D: Debug info
|
||||
N: Jordan Rose
|
||||
E: jordan_rose@apple.com
|
||||
G: jrose-apple
|
||||
D: ClangImporter, Serialization, PrintAsObjC, Driver, Frontend
|
||||
D: ClangImporter, Serialization, PrintAsClang, Driver, Frontend
|
||||
|
||||
N: Daniel Steffen
|
||||
E: dsteffen@apple.com
|
||||
|
||||
@@ -102,7 +102,7 @@ documentation, please create a thread on the Swift forums under the
|
||||
- [DependencyAnalysis.md](/docs/DependencyAnalysis.md):
|
||||
Describes different kinds of dependencies across files in the same module,
|
||||
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):
|
||||
Describes how C and ObjC entities are imported into Swift
|
||||
by the Clang Importer.
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
/// process does not necessarily converge to the canonical type, however.
|
||||
/// 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)
|
||||
/// This type is not present in valid, type-checked programs.
|
||||
|
||||
@@ -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
|
||||
//
|
||||
@@ -10,8 +10,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef SWIFT_PRINTASOBJC_H
|
||||
#define SWIFT_PRINTASOBJC_H
|
||||
#ifndef SWIFT_PRINTASCLANG_H
|
||||
#define SWIFT_PRINTASCLANG_H
|
||||
|
||||
#include "swift/Basic/LLVM.h"
|
||||
#include "swift/AST/AttrKind.h"
|
||||
@@ -64,7 +64,7 @@ getErrorDomainStringForObjC(const EnumDecl *ED) {
|
||||
for (const NominalTypeDecl * D = ED;
|
||||
D != nullptr;
|
||||
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.
|
||||
assert(D->getFormalAccess() >= AccessLevel::Internal &&
|
||||
"We don't currently append private discriminators");
|
||||
|
||||
@@ -2630,7 +2630,7 @@ getObjCObjectRepresentable(Type type, const DeclContext *dc) {
|
||||
///
|
||||
/// This function determines when and how a particular type is mapped
|
||||
/// 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.
|
||||
static std::pair<ForeignRepresentableKind, ProtocolConformance *>
|
||||
getForeignRepresentable(Type type, ForeignLanguage language,
|
||||
|
||||
@@ -35,7 +35,7 @@ add_subdirectory(Markup)
|
||||
add_subdirectory(Migrator)
|
||||
add_subdirectory(Option)
|
||||
add_subdirectory(Parse)
|
||||
add_subdirectory(PrintAsObjC)
|
||||
add_subdirectory(PrintAsClang)
|
||||
add_subdirectory(RemoteAST)
|
||||
add_subdirectory(Sema)
|
||||
add_subdirectory(Serialization)
|
||||
|
||||
@@ -3093,7 +3093,7 @@ namespace {
|
||||
if (!result)
|
||||
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.
|
||||
Impl.DeclsWithSuperfluousTypedefs.insert(decl);
|
||||
break;
|
||||
|
||||
@@ -21,7 +21,7 @@ target_link_libraries(swiftFrontendTool PRIVATE
|
||||
swiftIndex
|
||||
swiftIRGen
|
||||
swiftOption
|
||||
swiftPrintAsObjC
|
||||
swiftPrintAsClang
|
||||
swiftSerialization
|
||||
swiftSIL
|
||||
swiftSILGen
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
#include "swift/Option/Options.h"
|
||||
#include "swift/Migrator/FixitFilter.h"
|
||||
#include "swift/Migrator/Migrator.h"
|
||||
#include "swift/PrintAsObjC/PrintAsObjC.h"
|
||||
#include "swift/PrintAsClang/PrintAsClang.h"
|
||||
#include "swift/Serialization/SerializationOptions.h"
|
||||
#include "swift/Serialization/SerializedModuleLoader.h"
|
||||
#include "swift/SILOptimizer/PassManager/Passes.h"
|
||||
|
||||
12
lib/PrintAsClang/CMakeLists.txt
Normal file
12
lib/PrintAsClang/CMakeLists.txt
Normal 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)
|
||||
@@ -10,8 +10,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef SWIFT_PRINTASOBJC_DECLANDTYPEPRINTER_H
|
||||
#define SWIFT_PRINTASOBJC_DECLANDTYPEPRINTER_H
|
||||
#ifndef SWIFT_PRINTASCLANG_DECLANDTYPEPRINTER_H
|
||||
#define SWIFT_PRINTASCLANG_DECLANDTYPEPRINTER_H
|
||||
|
||||
#include "swift/AST/Type.h"
|
||||
// for OptionalTypeKind
|
||||
@@ -10,8 +10,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef SWIFT_PRINTASOBJC_MODULECONTENTSWRITER_H
|
||||
#define SWIFT_PRINTASOBJC_MODULECONTENTSWRITER_H
|
||||
#ifndef SWIFT_PRINTASCLANG_MODULECONTENTSWRITER_H
|
||||
#define SWIFT_PRINTASCLANG_MODULECONTENTSWRITER_H
|
||||
|
||||
#include "swift/AST/AttrKind.h"
|
||||
#include "swift/Basic/LLVM.h"
|
||||
@@ -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
|
||||
//
|
||||
@@ -10,7 +10,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/PrintAsObjC/PrintAsObjC.h"
|
||||
#include "swift/PrintAsClang/PrintAsClang.h"
|
||||
|
||||
#include "ModuleContentsWriter.h"
|
||||
|
||||
@@ -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)
|
||||
@@ -119,7 +119,7 @@ ValueDecl *DerivedConformance::deriveBridgedNSError(ValueDecl *requirement) {
|
||||
|
||||
auto scope = Nominal->getFormalAccessScope(Nominal->getModuleScopeContext());
|
||||
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.
|
||||
synthesizer = deriveBodyBridgedNSError_printAsObjCEnum_nsErrorDomain;
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ static void diagnoseFunctionParamNotRepresentable(
|
||||
static bool isParamListRepresentableInObjC(const AbstractFunctionDecl *AFD,
|
||||
const ParameterList *PL,
|
||||
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();
|
||||
auto &diags = ctx.Diags;
|
||||
auto behavior = behaviorLimitForObjCReason(Reason, ctx);
|
||||
@@ -598,7 +598,7 @@ bool swift::isRepresentableInObjC(
|
||||
asyncConvention = 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();
|
||||
DiagnosticStateRAII diagState(ctx.Diags);
|
||||
|
||||
@@ -1025,7 +1025,7 @@ bool swift::isRepresentableInObjC(
|
||||
}
|
||||
|
||||
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())
|
||||
return false;
|
||||
@@ -1085,7 +1085,7 @@ bool swift::isRepresentableInObjC(const VarDecl *VD, 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();
|
||||
DiagnosticStateRAII diagState(ctx.Diags);
|
||||
auto behavior = behaviorLimitForObjCReason(Reason, ctx);
|
||||
|
||||
Reference in New Issue
Block a user