Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[pull] main from apple:main #5530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
pull merged 63 commits into swiftwasm:main from swiftlang:main
Jun 18, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
49d7e04
[cxx-interop] C++ records should have address-only layout when they c...
hyp May 9, 2023
2c4188b
[cxx-interop] mark C++ classes with trivial_abi attribute as unavaila...
hyp May 9, 2023
84b212c
[ConstraintSytem] NFC: Remove unnecessary checking/counting from `cou...
xedin May 19, 2023
f12e24e
[Diagnostics] Skip overloaded locations where all solutions have the ...
xedin May 19, 2023
47a08e3
Enable IRGen/protocol_metadata test on Apple Silicon
karwa Jun 9, 2023
c6dd3ad
[CS] Diagnose UnresolvedPatternExprs as part of constraint solving
hamishknight Jun 13, 2023
fbbbd0d
[Macros] Allow keywords after `#` in freestanding macro expansions
ahoppen Jun 14, 2023
8b1c9c9
[Parse] InitAccessors: Parse initializer exprs associated with comput...
xedin Jun 15, 2023
290970a
[Build] Set swift-stdlib-tracing=0 for minimal stdlib builds.
mikeash Jun 15, 2023
988f373
[test] fix objcxx-arc-field-in-struct-type-layout-execution.swift tes...
hyp Jun 15, 2023
57e226d
[CanOSSALifetime] Bail early in lifetime extension
nate-chandler Jun 15, 2023
d1554f2
[AST] InitAccessors: Requestify a "has init accessor" check
xedin Jun 15, 2023
fc895b4
[Sema] Formalize a way to check whether storage is initializable
xedin Jun 15, 2023
f58d407
[Sema/SILGen] Consider init exprs associated with init accessor prope...
xedin Jun 15, 2023
7abd265
[cxx-interop] revert back to old address-only heuristic for MSVC
hyp Jun 15, 2023
a9f9bd1
[SourceKit] Record module loading errors when generating interfaces
hamishknight Jun 15, 2023
706985d
[Macros] Update plugin search options serialization
rintaro Jun 15, 2023
fc7ecc8
[Distributed] Harden typechecker against completely empty DAS types
ktoso Jun 16, 2023
8e66001
Merge pull request #66676 from hamishknight/interface-error
hamishknight Jun 16, 2023
e822a6a
Merge pull request #66643 from ahoppen/ahoppen/keyword-freestanding-m...
ahoppen Jun 16, 2023
b420190
Merge pull request #66695 from ktoso/wip-distributed-harden-empty-impls
ktoso Jun 16, 2023
49e9284
Merge pull request #66680 from nate-chandler/rdar110854874
nate-chandler Jun 16, 2023
cdc72fd
Merge pull request #66679 from mikeash/disable-tracing-minimal
mikeash Jun 16, 2023
4590aa1
Merge pull request #65813 from hyp/eng/passInRegs
hyp Jun 16, 2023
874ba08
SILDebugScopes: Don't ignore ConditionalClauseInitializerScope.
adrian-prantl Jun 16, 2023
9b69044
[TypeLowering] Move-only types are lexical.
nate-chandler Jun 16, 2023
f1a9e8b
Fix tests on arm64e
aschwaighofer Jun 16, 2023
c340d47
[TypeLowering] Move-only types are lexical.
nate-chandler Jun 16, 2023
0bf643d
Optimizer: add an additional DeadObjectElimination at the end of the ...
eeckstein Jun 16, 2023
f8bde21
Merge pull request #66035 from xedin/rdar-109245375
xedin Jun 16, 2023
f10d0df
Merge pull request #66593 from hamishknight/pattern-error
hamishknight Jun 16, 2023
a77cc30
Merge pull request #66706 from aschwaighofer/fix_arm64e_opaque_ptr_fa...
swift-ci Jun 16, 2023
e1d2198
[TypeResolution] Ban local variable packs (#66622)
simanerush Jun 16, 2023
9d342f1
Merge pull request #66681 from xedin/enable-inits-on-props-with-init-...
xedin Jun 16, 2023
6fa0c14
[Macros] Make 'PluginSearchOption' a external union
rintaro Jun 16, 2023
1ed9df0
[DebugInfo] Update tests to use opaque ptrs
felipepiovezan May 25, 2023
5d7aa84
[SILOpt] Don't opt move-only lifetimes.
nate-chandler Jun 16, 2023
9d4f4af
Merge pull request #66698 from eeckstein/dead-alloc-in-passpipeline
eeckstein Jun 16, 2023
13cdc66
Merge pull request #66705 from nate-chandler/rdar110901430
nate-chandler Jun 16, 2023
8db8451
[SILOpt] Don't opt move-only lifetimes.
nate-chandler Jun 16, 2023
329e428
Compute VarDeclScopeMap up front.
adrian-prantl Jun 16, 2023
fef3578
Temporarily disable assertion.
adrian-prantl Jun 16, 2023
d067453
[FieldSensitivePL] NFC: Implemented print.
nate-chandler Jun 8, 2023
934ec10
[Basic] Removed spurious req from FrozenMultiMap.
nate-chandler Jun 16, 2023
f4d8761
ModuleLoader: minor clean-up to remove dead code. NFC
nkcsgexi Jun 16, 2023
1ec900e
[Macros] Add default plugin paths for Darwin SDKs and platforms.
DougGregor Jun 16, 2023
22348e6
Merge pull request #66711 from DougGregor/old-driver-default-plugin-p...
DougGregor Jun 16, 2023
13a29a0
Merge pull request #66689 from rintaro/macros-serialization-pluginopts
rintaro Jun 16, 2023
36451ef
require `consume x` for noncopyable pattern bindings since they're co...
kavon Jun 16, 2023
874b577
[IRGen] Use EnumImplStrategy to generate getEnumTag function for layo...
drexin Jun 17, 2023
4e5ff2c
Merge pull request #66495 from karwa/patch-16
rjmccall Jun 17, 2023
ca29d53
Merge pull request #66716 from nate-chandler/rdar110913116
nate-chandler Jun 17, 2023
6709648
Merge pull request #66713 from kavon/require-switch-consume
swift-ci Jun 17, 2023
f4e3292
[FieldSensitivePL] Fix vectorization.
nate-chandler Jun 16, 2023
b97712c
[MoveOnlyAddressChecker] NFC: Promoted assertion.
nate-chandler Jun 8, 2023
eaf4560
[MoveOnlyAddressChecker] Maximize lifetimes.
nate-chandler Jun 12, 2023
11443f2
[move-only] Avoid loc from func decl.
nate-chandler Jun 17, 2023
2bfa723
[MoveOnlyAddressChecker] Added extension flag.
nate-chandler Jun 17, 2023
cbd0b15
Merge pull request #66712 from felipepiovezan/felipe/update_debug_inf...
felipepiovezan Jun 17, 2023
c2f164d
Merge pull request #66692 from adrian-prantl/110841130
adrian-prantl Jun 17, 2023
606eef6
Merge pull request #66719 from nkcsgexi/clean-up-framework
nkcsgexi Jun 17, 2023
91ee824
Merge pull request #66690 from nate-chandler/rdar110676577
nate-chandler Jun 17, 2023
d312589
Merge pull request #66585 from nate-chandler/rdar99681073
nate-chandler Jun 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 76 additions & 20 deletions include/swift/AST/SearchPathOptions.h
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#define SWIFT_AST_SEARCHPATHOPTIONS_H

#include "swift/Basic/ArrayRefView.h"
#include "swift/Basic/ExternalUnion.h"
#include "swift/Basic/PathRemapper.h"
#include "swift/Basic/TaggedUnion.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/StringMap.h"
Expand Down Expand Up @@ -187,25 +187,81 @@ struct ExternalPluginSearchPathAndServerPath {
std::string ServerPath;
};

namespace PluginSearchOption {
struct LoadPluginLibrary {
std::string LibraryPath;
};
struct LoadPluginExecutable {
std::string ExecutablePath;
std::vector<std::string> ModuleNames;
};
struct PluginPath {
std::string SearchPath;
};
struct ExternalPluginPath {
std::string SearchPath;
std::string ServerPath;
};
class PluginSearchOption {
public:
struct LoadPluginLibrary {
std::string LibraryPath;
};
struct LoadPluginExecutable {
std::string ExecutablePath;
std::vector<std::string> ModuleNames;
};
struct PluginPath {
std::string SearchPath;
};
struct ExternalPluginPath {
std::string SearchPath;
std::string ServerPath;
};

enum class Kind : uint8_t {
LoadPluginLibrary,
LoadPluginExecutable,
PluginPath,
ExternalPluginPath,
};

using Value = TaggedUnion<LoadPluginLibrary, LoadPluginExecutable, PluginPath,
ExternalPluginPath>;
} // namespace PluginSearchOption
private:
using Members = ExternalUnionMembers<LoadPluginLibrary, LoadPluginExecutable,
PluginPath, ExternalPluginPath>;
static Members::Index getIndexForKind(Kind kind) {
switch (kind) {
case Kind::LoadPluginLibrary:
return Members::indexOf<LoadPluginLibrary>();
case Kind::LoadPluginExecutable:
return Members::indexOf<LoadPluginExecutable>();
case Kind::PluginPath:
return Members::indexOf<PluginPath>();
case Kind::ExternalPluginPath:
return Members::indexOf<ExternalPluginPath>();
}
};
using Storage = ExternalUnion<Kind, Members, getIndexForKind>;

Kind kind;
Storage storage;

public:
PluginSearchOption(const LoadPluginLibrary &v)
: kind(Kind::LoadPluginLibrary) {
storage.emplace<LoadPluginLibrary>(kind, v);
}
PluginSearchOption(const LoadPluginExecutable &v)
: kind(Kind::LoadPluginExecutable) {
storage.emplace<LoadPluginExecutable>(kind, v);
}
PluginSearchOption(const PluginPath &v) : kind(Kind::PluginPath) {
storage.emplace<PluginPath>(kind, v);
}
PluginSearchOption(const ExternalPluginPath &v)
: kind(Kind::ExternalPluginPath) {
storage.emplace<ExternalPluginPath>(kind, v);
}

Kind getKind() const { return kind; }

template <typename T>
const T *dyn_cast() const {
if (Members::indexOf<T>() != getIndexForKind(kind))
return nullptr;
return &storage.get<T>(kind);
}

template <typename T>
const T &get() const {
return storage.get<T>(kind);
}
};

/// Options for controlling search path behavior.
class SearchPathOptions {
Expand Down Expand Up @@ -383,7 +439,7 @@ class SearchPathOptions {
std::vector<std::string> RuntimeLibraryPaths;

/// Plugin search path options.
std::vector<PluginSearchOption::Value> PluginSearchOpts;
std::vector<PluginSearchOption> PluginSearchOpts;

/// Don't look in for compiler-provided modules.
bool SkipRuntimeLibraryImportPaths = false;
Expand Down
6 changes: 2 additions & 4 deletions include/swift/Serialization/SerializationOptions.h
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#ifndef SWIFT_SERIALIZATION_SERIALIZATIONOPTIONS_H
#define SWIFT_SERIALIZATION_SERIALIZATIONOPTIONS_H

#include "swift/AST/SearchPathOptions.h"
#include "swift/Basic/LLVM.h"
#include "swift/Basic/PathRemapper.h"
#include "llvm/Support/VersionTuple.h"
Expand Down Expand Up @@ -43,10 +44,7 @@ namespace swift {
StringRef ModuleLinkName;
StringRef ModuleInterface;
std::vector<std::string> ExtraClangOptions;
std::vector<std::string> PluginSearchPaths;
std::vector<std::string> ExternalPluginSearchPaths;
std::vector<std::string> CompilerPluginLibraryPaths;
std::vector<std::string> CompilerPluginExecutablePaths;
std::vector<swift::PluginSearchOption> PluginSearchOptions;

/// Path prefixes that should be rewritten in debug info.
PathRemapper DebuggingOptionsPrefixMap;
Expand Down
37 changes: 8 additions & 29 deletions include/swift/Serialization/Validation.h
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,8 @@ struct ValidationInfo {
class ExtendedValidationInfo {
SmallVector<StringRef, 4> ExtraClangImporterOpts;

SmallVector<StringRef, 1> PluginSearchPaths;
SmallVector<StringRef, 1> ExternalPluginSearchPaths;
SmallVector<StringRef, 1> CompilerPluginLibraryPaths;
SmallVector<StringRef, 1> CompilerPluginExecutablePaths;
SmallVector<std::pair<PluginSearchOption::Kind, StringRef>, 2>
PluginSearchOptions;

std::string SDKPath;
StringRef ModuleABIName;
Expand Down Expand Up @@ -149,32 +147,13 @@ class ExtendedValidationInfo {
ExtraClangImporterOpts.push_back(option);
}

ArrayRef<StringRef> getPluginSearchPaths() const {
return PluginSearchPaths;
ArrayRef<std::pair<PluginSearchOption::Kind, StringRef>>
getPluginSearchOptions() const {
return PluginSearchOptions;
}
void addPluginSearchPath(StringRef path) {
PluginSearchPaths.push_back(path);
}

ArrayRef<StringRef> getExternalPluginSearchPaths() const {
return ExternalPluginSearchPaths;
}
void addExternalPluginSearchPath(StringRef path) {
ExternalPluginSearchPaths.push_back(path);
}

ArrayRef<StringRef> getCompilerPluginLibraryPaths() const {
return CompilerPluginLibraryPaths;
}
void addCompilerPluginLibraryPath(StringRef path) {
CompilerPluginLibraryPaths.push_back(path);
}

ArrayRef<StringRef> getCompilerPluginExecutablePaths() const {
return CompilerPluginExecutablePaths;
}
void addCompilerPluginExecutablePath(StringRef path) {
CompilerPluginExecutablePaths.push_back(path);
void addPluginSearchOption(
const std::pair<PluginSearchOption::Kind, StringRef> &opt) {
PluginSearchOptions.push_back(opt);
}

bool isSIB() const { return Bits.IsSIB; }
Expand Down
30 changes: 18 additions & 12 deletions lib/AST/PluginLoader.cpp
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,31 @@ PluginLoader::lookupPluginByModuleName(Identifier moduleName) {

// FIXME: Should we create a lookup table keyed by module name?
for (auto &entry : Ctx.SearchPathOpts.PluginSearchOpts) {
using namespace PluginSearchOption;
switch (entry.getKind()) {
// Try '-load-plugin-library'.
if (auto *val = entry.dyn_cast<LoadPluginLibrary>()) {
if (llvm::sys::path::filename(val->LibraryPath) == pluginLibBasename) {
return {val->LibraryPath, ""};
case PluginSearchOption::Kind::LoadPluginLibrary: {
auto &val = entry.get<PluginSearchOption::LoadPluginLibrary>();
if (llvm::sys::path::filename(val.LibraryPath) == pluginLibBasename) {
return {val.LibraryPath, ""};
}
continue;
}

// Try '-load-plugin-executable'.
if (auto *v = entry.dyn_cast<LoadPluginExecutable>()) {
case PluginSearchOption::Kind::LoadPluginExecutable: {
auto &val = entry.get<PluginSearchOption::LoadPluginExecutable>();
auto found = ExecutablePluginPaths.find(moduleName);
if (found != ExecutablePluginPaths.end()) {
return {"", std::string(found->second)};
if (found != ExecutablePluginPaths.end() &&
found->second == val.ExecutablePath) {
return {"", val.ExecutablePath};
}
continue;
}

// Try '-plugin-path'.
if (auto *v = entry.dyn_cast<PluginPath>()) {
SmallString<128> fullPath(v->SearchPath);
case PluginSearchOption::Kind::PluginPath: {
auto &val = entry.get<PluginSearchOption::PluginPath>();
SmallString<128> fullPath(val.SearchPath);
llvm::sys::path::append(fullPath, pluginLibBasename);
if (fs->exists(fullPath)) {
return {std::string(fullPath), ""};
Expand All @@ -90,14 +94,16 @@ PluginLoader::lookupPluginByModuleName(Identifier moduleName) {
}

// Try '-external-plugin-path'.
if (auto *v = entry.dyn_cast<ExternalPluginPath>()) {
SmallString<128> fullPath(v->SearchPath);
case PluginSearchOption::Kind::ExternalPluginPath: {
auto &val = entry.get<PluginSearchOption::ExternalPluginPath>();
SmallString<128> fullPath(val.SearchPath);
llvm::sys::path::append(fullPath, pluginLibBasename);
if (fs->exists(fullPath)) {
return {std::string(fullPath), v->ServerPath};
return {std::string(fullPath), val.ServerPath};
}
continue;
}
}
}

return {};
Expand Down
32 changes: 2 additions & 30 deletions lib/Frontend/Frontend.cpp
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -209,36 +209,8 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
serializationOpts.ExtraClangOptions = getClangImporterOptions().ExtraArgs;
}

// FIXME: Preserve the order of these options.
for (auto &elem : getSearchPathOptions().PluginSearchOpts) {
// '-plugin-path' options.
if (auto *arg = elem.dyn_cast<PluginSearchOption::PluginPath>()) {
serializationOpts.PluginSearchPaths.push_back(arg->SearchPath);
continue;
}

// '-external-plugin-path' options.
if (auto *arg = elem.dyn_cast<PluginSearchOption::ExternalPluginPath>()) {
serializationOpts.ExternalPluginSearchPaths.push_back(
arg->SearchPath + "#" + arg->ServerPath);
continue;
}

// '-load-plugin-library' options.
if (auto *arg = elem.dyn_cast<PluginSearchOption::LoadPluginLibrary>()) {
serializationOpts.CompilerPluginLibraryPaths.push_back(arg->LibraryPath);
continue;
}

// '-load-plugin-executable' options.
if (auto *arg = elem.dyn_cast<PluginSearchOption::LoadPluginExecutable>()) {
std::string optStr = arg->ExecutablePath + "#";
llvm::interleave(
arg->ModuleNames, [&](auto &name) { optStr += name; },
[&]() { optStr += ","; });
serializationOpts.CompilerPluginExecutablePaths.push_back(optStr);
}
}
serializationOpts.PluginSearchOptions =
getSearchPathOptions().PluginSearchOpts;

serializationOpts.DisableCrossModuleIncrementalInfo =
opts.DisableCrossModuleIncrementalBuild;
Expand Down
31 changes: 20 additions & 11 deletions lib/Serialization/ModuleFileSharedCore.cpp
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,27 @@ static bool readOptionsBlock(llvm::BitstreamCursor &cursor,
case options_block::XCC:
extendedInfo.addExtraClangImporterOption(blobData);
break;
case options_block::PLUGIN_SEARCH_PATH:
extendedInfo.addPluginSearchPath(blobData);
break;
case options_block::EXTERNAL_SEARCH_PLUGIN_PATH:
extendedInfo.addExternalPluginSearchPath(blobData);
break;
case options_block::COMPILER_PLUGIN_LIBRARY_PATH:
extendedInfo.addCompilerPluginLibraryPath(blobData);
break;
case options_block::COMPILER_PLUGIN_EXECUTABLE_PATH:
extendedInfo.addCompilerPluginExecutablePath(blobData);
case options_block::PLUGIN_SEARCH_OPTION: {
unsigned kind;
options_block::ResilienceStrategyLayout::readRecord(scratch, kind);
PluginSearchOption::Kind optKind;
switch (PluginSearchOptionKind(kind)) {
case PluginSearchOptionKind::PluginPath:
optKind = PluginSearchOption::Kind::PluginPath;
break;
case PluginSearchOptionKind::ExternalPluginPath:
optKind = PluginSearchOption::Kind::ExternalPluginPath;
break;
case PluginSearchOptionKind::LoadPluginLibrary:
optKind = PluginSearchOption::Kind::LoadPluginLibrary;
break;
case PluginSearchOptionKind::LoadPluginExecutable:
optKind = PluginSearchOption::Kind::LoadPluginExecutable;
break;
}
extendedInfo.addPluginSearchOption({optKind, blobData});
break;
}
case options_block::IS_SIB:
bool IsSIB;
options_block::IsSIBLayout::readRecord(scratch, IsSIB);
Expand Down
39 changes: 16 additions & 23 deletions lib/Serialization/ModuleFormat.h
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t SWIFTMODULE_VERSION_MINOR = 792; // removed select_value
const uint16_t SWIFTMODULE_VERSION_MINOR = 793; // PluginSearchOption

/// A standard hash seed used for all string hashes in a serialized module.
///
Expand Down Expand Up @@ -651,6 +651,16 @@ enum class MacroIntroducedDeclNameKind : uint8_t {
};
using MacroIntroducedDeclNameKindField = BCFixed<4>;

// These IDs must \em not be renumbered or reordered without incrementing
// the module version.
enum class PluginSearchOptionKind : uint8_t {
PluginPath,
ExternalPluginPath,
LoadPluginLibrary,
LoadPluginExecutable,
};
using PluginSearchOptionKindField = BCFixed<3>;

// Encodes a VersionTuple:
//
// Major
Expand Down Expand Up @@ -884,10 +894,7 @@ namespace options_block {
IS_CONCURRENCY_CHECKED,
MODULE_PACKAGE_NAME,
MODULE_EXPORT_AS_NAME,
PLUGIN_SEARCH_PATH,
EXTERNAL_SEARCH_PLUGIN_PATH,
COMPILER_PLUGIN_LIBRARY_PATH,
COMPILER_PLUGIN_EXECUTABLE_PATH,
PLUGIN_SEARCH_OPTION,
HAS_CXX_INTEROPERABILITY_ENABLED,
};

Expand All @@ -901,24 +908,10 @@ namespace options_block {
BCBlob // -Xcc flag, as string
>;

using PluginSearchPathLayout = BCRecordLayout<
PLUGIN_SEARCH_PATH,
BCBlob // -plugin-path value
>;

using ExternalPluginSearchPathLayout = BCRecordLayout<
EXTERNAL_SEARCH_PLUGIN_PATH,
BCBlob // -external-plugin-path value
>;

using CompilerPluginLibraryPathLayout = BCRecordLayout<
COMPILER_PLUGIN_LIBRARY_PATH,
BCBlob // -load-plugin-library value
>;

using CompilerPluginExecutablePathLayout = BCRecordLayout<
COMPILER_PLUGIN_EXECUTABLE_PATH,
BCBlob // -load-plugin-executable value
using PluginSearchOptionLayout = BCRecordLayout<
PLUGIN_SEARCH_OPTION,
PluginSearchOptionKindField, // kind
BCBlob // option value string
>;

using IsSIBLayout = BCRecordLayout<
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /