Skip to content

Commit

Permalink
[NFC][interop] rename the PrintAsObjC library to PrintAsClang
Browse files Browse the repository at this point in the history
We're starting to support emission of C++ header interfaces, so a language-agnostic name makes more sense
  • Loading branch information
hyp committed Jan 20, 2022
1 parent 7aa1cd1 commit e106551
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion CODE_OWNERS.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ D: Debug info
N: Jordan Rose
E: [email protected]
G: jrose-apple
D: ClangImporter, Serialization, PrintAsObjC, Driver, Frontend
D: ClangImporter, Serialization, PrintAsClang, Driver, Frontend

N: Daniel Steffen
E: [email protected]
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/TypeNodes.def
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
//
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/SwiftNameTranslation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/ClangImporter/ImportDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/FrontendTool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ target_link_libraries(swiftFrontendTool PRIVATE
swiftIndex
swiftIRGen
swiftOption
swiftPrintAsObjC
swiftPrintAsClang
swiftSerialization
swiftSIL
swiftSILGen
Expand Down
2 changes: 1 addition & 1 deletion lib/FrontendTool/FrontendTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 12 additions & 0 deletions lib/PrintAsClang/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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
//
Expand All @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

#include "swift/PrintAsObjC/PrintAsObjC.h"
#include "swift/PrintAsClang/PrintAsClang.h"

#include "ModuleContentsWriter.h"

Expand Down
12 changes: 0 additions & 12 deletions lib/PrintAsObjC/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion lib/Sema/DerivedConformanceError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions lib/Sema/TypeCheckDeclObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e106551

Please sign in to comment.