Skip to content

Commit dc24d16

Browse files
authored
Merge pull request #3864 from swiftwasm/main
2 parents 15708cc + 0603991 commit dc24d16

35 files changed

+1531
-768
lines changed

include/swift-c/DependencyScan/DependencyScan.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,17 @@ swiftscan_batch_scan_result_dispose(swiftscan_batch_scan_result_t *result);
300300
SWIFTSCAN_PUBLIC void
301301
swiftscan_scan_invocation_dispose(swiftscan_scan_invocation_t invocation);
302302

303-
//=== Feature-Query Functions -----------------------------------------===//
303+
//=== Feature-Query Functions ---------------------------------------------===//
304304
SWIFTSCAN_PUBLIC swiftscan_string_set_t *
305305
swiftscan_compiler_supported_arguments_query();
306306

307307
SWIFTSCAN_PUBLIC swiftscan_string_set_t *
308308
swiftscan_compiler_supported_features_query();
309309

310+
//=== Target-Info Functions -----------------------------------------------===//
311+
SWIFTSCAN_PUBLIC swiftscan_string_ref_t
312+
swiftscan_compiler_target_info_query(swiftscan_scan_invocation_t invocation);
313+
310314
//=== Scanner Functions ---------------------------------------------------===//
311315

312316
/// Container of the configuration state and shared cache for dependency

include/swift/Basic/TargetInfo.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//===--- TargetInfo.h - Target Info Output ---------------------*- C++ -*-===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
//
13+
// This file provides a high-level API for emitting target info
14+
//
15+
//===----------------------------------------------------------------------===//
16+
17+
#ifndef SWIFT_TARGETINFO_H
18+
#define SWIFT_TARGETINFO_H
19+
20+
#include "swift/Basic/LLVM.h"
21+
22+
namespace llvm {
23+
class Triple;
24+
class VersionTuple;
25+
}
26+
27+
namespace swift {
28+
class CompilerInvocation;
29+
30+
namespace targetinfo {
31+
void printTargetInfo(const CompilerInvocation &invocation,
32+
llvm::raw_ostream &out);
33+
34+
void printTripleInfo(const llvm::Triple &triple,
35+
llvm::Optional<llvm::VersionTuple> runtimeVersion,
36+
llvm::raw_ostream &out);
37+
} // namespace targetinfo
38+
} // namespace swift
39+
40+
#endif

include/swift/DependencyScan/DependencyScanningTool.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
namespace swift {
2525
namespace dependencies {
2626

27+
/// Given a set of arguments to a print-target-info frontend tool query, produce the
28+
/// JSON target info.
29+
llvm::ErrorOr<swiftscan_string_ref_t> getTargetInfo(ArrayRef<const char *> Command);
30+
2731
/// The high-level implementation of the dependency scanner that runs on
2832
/// an individual worker thread.
2933
class DependencyScanningTool {

include/swift/SIL/SILInstruction.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,6 +1949,10 @@ class AllocStackInst final
19491949
/// Whether the alloc_stack instruction corresponds to a source-level VarDecl.
19501950
bool isLexical() const { return lexical; }
19511951

1952+
/// If this is a lexical borrow, eliminate the lexical bit. If this borrow
1953+
/// doesn't have a lexical bit, do not do anything.
1954+
void removeIsLexical() { lexical = false; }
1955+
19521956
/// Return the debug variable information attached to this instruction.
19531957
Optional<SILDebugVariable> getVarInfo() const {
19541958
Optional<SILType> AuxVarType;
@@ -4033,6 +4037,10 @@ class BeginBorrowInst
40334037
/// source-level lexical scope.
40344038
bool isLexical() const { return lexical; }
40354039

4040+
/// If this is a lexical borrow, eliminate the lexical bit. If this borrow
4041+
/// doesn't have a lexical bit, do not do anything.
4042+
void removeIsLexical() { lexical = false; }
4043+
40364044
/// Return a range over all EndBorrow instructions for this BeginBorrow.
40374045
EndBorrowRange getEndBorrows() const;
40384046

include/swift/SILOptimizer/PassManager/Passes.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ PASS(MoveOnlyChecker, "sil-move-only-checker",
425425
PASS(MoveKillsCopyableValuesChecker, "sil-move-kills-copyable-values-checker",
426426
"Pass that checks that any copyable (non-move only) value that is passed "
427427
"to _move do not have any uses later than the _move")
428+
PASS(LexicalLifetimeEliminator, "sil-lexical-lifetime-eliminator",
429+
"Pass that removes lexical lifetime markers from borrows and alloc stack")
428430
PASS(PruneVTables, "prune-vtables",
429431
"Mark class methods that do not require vtable dispatch")
430432
PASS_RANGE(AllPasses, AADumper, PruneVTables)

lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3414,9 +3414,6 @@ void PrintAST::printOneParameter(const ParamDecl *param,
34143414

34153415
printAttributes(param);
34163416

3417-
if (param->isIsolated())
3418-
Printer << "isolated ";
3419-
34203417
printArgName();
34213418

34223419
TypeLoc TheTypeLoc;

lib/AST/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ add_swift_host_library(swiftAST STATIC
8080
RequirementMachine/KnuthBendix.cpp
8181
RequirementMachine/PropertyMap.cpp
8282
RequirementMachine/PropertyUnification.cpp
83+
RequirementMachine/RequirementLowering.cpp
8384
RequirementMachine/RequirementMachine.cpp
8485
RequirementMachine/RequirementMachineRequests.cpp
8586
RequirementMachine/RewriteContext.cpp

lib/AST/NameLookup.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,10 +1456,25 @@ DirectLookupRequest::evaluate(Evaluator &evaluator,
14561456
auto allFound = evaluateOrDefault(
14571457
ctx.evaluator, CXXNamespaceMemberLookup({cast<EnumDecl>(decl), name}),
14581458
{});
1459-
for (auto found : allFound)
1460-
Table.addMember(found);
1461-
14621459
populateLookupTableEntryFromExtensions(ctx, Table, baseName, decl);
1460+
1461+
// Bypass the regular member lookup table if we find something in
1462+
// the original C++ namespace. We don't want to store the C++ decl in the
1463+
// lookup table as the decl can be referenced from multiple namespace
1464+
// declarations due to inline namespaces. We still merge in the other
1465+
// entries found in the lookup table, to support finding members in
1466+
// namespace extensions.
1467+
if (!allFound.empty()) {
1468+
auto known = Table.find(name);
1469+
if (known != Table.end()) {
1470+
auto swiftLookupResult = maybeFilterOutAttrImplements(
1471+
known->second, name, includeAttrImplements);
1472+
for (auto foundSwiftDecl : swiftLookupResult) {
1473+
allFound.push_back(foundSwiftDecl);
1474+
}
1475+
}
1476+
return allFound;
1477+
}
14631478
} else if (isa_and_nonnull<clang::RecordDecl>(decl->getClangDecl())) {
14641479
auto allFound = evaluateOrDefault(
14651480
ctx.evaluator,

0 commit comments

Comments
 (0)