Skip to content

Commit 5ac9f1d

Browse files
authored
Merge pull request #4139 from swiftwasm/main
[pull] swiftwasm from main
2 parents 4984691 + c788d94 commit 5ac9f1d

34 files changed

+139
-65
lines changed

CODE_OWNERS.TXT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ D: Debug info
7575
N: Jordan Rose
7676
7777
G: jrose-apple
78-
D: ClangImporter, Serialization, PrintAsObjC, Driver, Frontend
78+
D: ClangImporter, Serialization, PrintAsClang, Driver, Frontend
7979

8080
N: Daniel Steffen
8181

docs/README.md

Lines changed: 1 addition & 1 deletion
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/DiagnosticsParse.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ ERROR(decl_expected_module_name,none,
315315
ERROR(expected_module_alias,none,
316316
"cannot refer to module as %0 because it has been aliased; use %1 "
317317
"instead", (Identifier, Identifier))
318+
ERROR(unexpected_operator_in_import_path,none,
319+
"cannot include postfix operator in import declaration",())
318320

319321
// Extension
320322
ERROR(expected_lbrace_extension,PointsToFirstBadToken,

include/swift/AST/TypeNodes.def

Lines changed: 1 addition & 1 deletion
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/Basic/PathRemapper.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace swift {
3535

3636
class PathRemapper {
3737
SmallVector<std::pair<std::string, std::string>, 2> PathMappings;
38-
38+
friend class PathObfuscator;
3939
public:
4040
/// Adds a mapping such that any paths starting with `FromPrefix` have that
4141
/// portion replaced with `ToPrefix`.
@@ -72,6 +72,11 @@ class PathObfuscator {
7272
std::string recover(StringRef Path) const {
7373
return recoverer.remapPath(Path);
7474
}
75+
void forEachPair(llvm::function_ref<void(StringRef, StringRef)> op) const {
76+
for (auto pair: obfuscator.PathMappings) {
77+
op(pair.first, pair.second);
78+
}
79+
}
7580
};
7681

7782
} // end namespace swift

include/swift/Frontend/Frontend.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ class CompilerInvocation {
174174
SearchPathOpts.setImportSearchPaths(Paths);
175175
}
176176

177+
void setSerializedPathObfuscator(const PathObfuscator &obfuscator) {
178+
FrontendOpts.serializedPathObfuscator = obfuscator;
179+
SearchPathOpts.DeserializedPathRecoverer = obfuscator;
180+
}
181+
177182
ArrayRef<std::string> getImportSearchPaths() const {
178183
return SearchPathOpts.getImportSearchPaths();
179184
}

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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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)

0 commit comments

Comments
 (0)