Skip to content

Commit 8c6ad33

Browse files
committed
---
yaml --- r: 349131 b: refs/heads/master c: f90930f h: refs/heads/master i: 349129: 5c36c58 349127: b5f8afa
1 parent 83be432 commit 8c6ad33

File tree

14 files changed

+26
-90
lines changed

14 files changed

+26
-90
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: bd94891745fbc4c1bcf53213e207f4bf77c073df
2+
refs/heads/master: f90930feece291929f1746f3031b802056f3003b
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/include/swift/SIL/SILDeclRef.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,6 @@ struct SILDeclRef {
249249
bool isStoredPropertyInitializer() const {
250250
return kind == Kind::StoredPropertyInitializer;
251251
}
252-
/// True if the SILDeclRef references the initializer for the backing storage
253-
/// of a property wrapper.
254-
bool isPropertyWrapperBackingInitializer() const {
255-
return kind == Kind::PropertyWrapperBackingInitializer;
256-
}
257252

258253
/// True if the SILDeclRef references the ivar initializer or deinitializer of
259254
/// a class.

trunk/lib/Frontend/Frontend.cpp

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -318,23 +318,6 @@ void CompilerInstance::setUpDiagnosticOptions() {
318318
}
319319
}
320320

321-
// The ordering of ModuleLoaders is important!
322-
//
323-
// 1. SourceLoader: This is a hack and only the compiler's tests are using it,
324-
// to avoid writing repetitive code involving generating modules/interfaces.
325-
// Ideally, we'd get rid of it.
326-
// 2. MemoryBufferSerializedModuleLoader: This is used by LLDB, because it might
327-
// already have the module available in memory.
328-
// 3. ModuleInterfaceLoader: Tries to find an up-to-date swiftmodule. If it
329-
// succeeds, it issues a particular "error" (see
330-
// [Note: ModuleInterfaceLoader-defer-to-SerializedModuleLoader]), which
331-
// is interpreted by the overarching loader as a command to use the
332-
// SerializedModuleLoader. If we failed to find a .swiftmodule, this falls
333-
// back to using an interface. Actual errors lead to diagnostics.
334-
// 4. SerializedModuleLoader: Loads a serialized module if it can.
335-
// 5. ClangImporter: This must come after all the Swift module loaders because
336-
// in the presence of overlays and mixed-source frameworks, we want to prefer
337-
// the overlay or framework module over the underlying Clang module.
338321
bool CompilerInstance::setUpModuleLoaders() {
339322
if (hasSourceImport()) {
340323
bool enableLibraryEvolution =
@@ -371,6 +354,10 @@ bool CompilerInstance::setUpModuleLoaders() {
371354
Context->addModuleLoader(std::move(MemoryBufferLoader));
372355
}
373356

357+
std::unique_ptr<SerializedModuleLoader> SML =
358+
SerializedModuleLoader::create(*Context, getDependencyTracker(), MLM);
359+
this->SML = SML.get();
360+
374361
// Wire up the Clang importer. If the user has specified an SDK, use it.
375362
// Otherwise, we just keep it around as our interface to Clang's ABI
376363
// knowledge.
@@ -393,12 +380,7 @@ bool CompilerInstance::setUpModuleLoaders() {
393380
FEOpts.RemarkOnRebuildFromModuleInterface);
394381
Context->addModuleLoader(std::move(PIML));
395382
}
396-
397-
std::unique_ptr<SerializedModuleLoader> SML =
398-
SerializedModuleLoader::create(*Context, getDependencyTracker(), MLM);
399-
this->SML = SML.get();
400383
Context->addModuleLoader(std::move(SML));
401-
402384
Context->addModuleLoader(std::move(clangImporter), /*isClang*/ true);
403385

404386
return false;

trunk/lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,6 @@ class ModuleInterfaceLoaderImpl {
764764
}
765765
}
766766

767-
// [Note: ModuleInterfaceLoader-defer-to-SerializedModuleLoader]
768767
// Finally, if there's a module adjacent to the .swiftinterface that we can
769768
// _likely_ load (it validates OK and is up to date), bail early with
770769
// errc::not_supported, so the next (serialized) loader in the chain will

trunk/lib/SIL/SILProfiler.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ static bool canCreateProfilerForAST(ASTNode N, SILDeclRef forDecl) {
135135
return true;
136136
} else if (auto *E = N.get<Expr *>()) {
137137
if (forDecl.isStoredPropertyInitializer() ||
138-
forDecl.isPropertyWrapperBackingInitializer() ||
139138
forDecl.getAbstractClosureExpr())
140139
return true;
141140
}
@@ -152,10 +151,8 @@ SILProfiler *SILProfiler::create(SILModule &M, ForDefinition_t forDefinition,
152151
if (!doesASTRequireProfiling(M, N) && Opts.UseProfile.empty())
153152
return nullptr;
154153

155-
if (!canCreateProfilerForAST(N, forDecl)) {
156-
N.dump(llvm::errs());
154+
if (!canCreateProfilerForAST(N, forDecl))
157155
llvm_unreachable("Invalid AST node for profiling");
158-
}
159156

160157
auto *Buf = M.allocate<SILProfiler>(1);
161158
auto *SP =

trunk/lib/SILGen/SILGen.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,11 +1145,10 @@ emitPropertyWrapperBackingInitializer(VarDecl *var) {
11451145
preEmitFunction(constant, var, f, var);
11461146
PrettyStackTraceSILFunction X(
11471147
"silgen emitPropertyWrapperBackingInitializer", f);
1148+
f->createProfiler(var, constant, ForDefinition);
1149+
auto varDC = var->getInnermostDeclContext();
11481150
auto wrapperInfo = var->getPropertyWrapperBackingPropertyInfo();
11491151
assert(wrapperInfo.initializeFromOriginal);
1150-
f->createProfiler(wrapperInfo.initializeFromOriginal, constant,
1151-
ForDefinition);
1152-
auto varDC = var->getInnermostDeclContext();
11531152
SILGenFunction SGF(*this, *f, varDC);
11541153
SGF.emitGeneratorFunction(constant, wrapperInfo.initializeFromOriginal);
11551154
postEmitFunction(constant, f);

trunk/lib/Sema/TypeCheckConstraints.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,8 @@ namespace {
11191119
return finish(walkToClosureExprPre(closure), expr);
11201120

11211121
if (auto unresolved = dyn_cast<UnresolvedDeclRefExpr>(expr)) {
1122-
TC.checkForForbiddenPrefix(unresolved);
1122+
TypeChecker::checkForForbiddenPrefix(
1123+
TC.Context, unresolved->getName().getBaseName());
11231124
return finish(true, TC.resolveDeclRefExpr(unresolved, DC));
11241125
}
11251126

trunk/lib/Sema/TypeCheckDecl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,6 +2211,8 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
22112211

22122212
if (auto VD = dyn_cast<ValueDecl>(decl)) {
22132213
auto &Context = TC.Context;
2214+
TypeChecker::checkForForbiddenPrefix(Context, VD->getBaseName());
2215+
22142216
checkRedeclaration(Context, VD);
22152217

22162218
// Force some requests, which can produce diagnostics.
@@ -3594,7 +3596,6 @@ bool TypeChecker::isAvailabilitySafeForConformance(
35943596
}
35953597

35963598
void TypeChecker::typeCheckDecl(Decl *D) {
3597-
checkForForbiddenPrefix(D);
35983599
DeclChecker(*this).visit(D);
35993600
}
36003601

@@ -4127,7 +4128,7 @@ void TypeChecker::validateDecl(ValueDecl *D) {
41274128
PrettyStackTraceDecl StackTrace("validating", D);
41284129
FrontendStatsTracer StatsTracer(Context.Stats, "validate-decl", D);
41294130

4130-
checkForForbiddenPrefix(D);
4131+
TypeChecker::checkForForbiddenPrefix(Context, D->getBaseName());
41314132

41324133
if (Context.Stats)
41334134
Context.Stats->getFrontendCounters().NumDeclsValidated++;

trunk/lib/Sema/TypeCheckPattern.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,9 +1006,9 @@ bool TypeChecker::coercePatternToType(Pattern *&P, TypeResolution resolution,
10061006
P->setType(type);
10071007
var->setNamingPattern(NP);
10081008

1009-
// FIXME: Should probably just remove the forbidden prefix stuff, it no
1010-
// longer makes a lot of sense in a request-based world.
1011-
checkForForbiddenPrefix(var);
1009+
// FIXME: This call can be removed once pattern binding validation is
1010+
// sufficiently requestified.
1011+
TypeChecker::checkForForbiddenPrefix(Context, var->getBaseName());
10121012

10131013
// If we are inferring a variable to have type AnyObject.Type,
10141014
// "()", an uninhabited type, or optional thereof, emit a diagnostic.

trunk/lib/Sema/TypeChecker.cpp

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -729,38 +729,18 @@ TypeChecker &swift::createTypeChecker(ASTContext &Ctx) {
729729
return TypeChecker::createForContext(Ctx);
730730
}
731731

732-
// checkForForbiddenPrefix is for testing purposes.
733-
734-
void TypeChecker::checkForForbiddenPrefix(const Decl *D) {
735-
if (!hasEnabledForbiddenTypecheckPrefix())
732+
void TypeChecker::checkForForbiddenPrefix(ASTContext &C, DeclBaseName Name) {
733+
if (C.LangOpts.DebugForbidTypecheckPrefix.empty())
736734
return;
737-
if (auto VD = dyn_cast<ValueDecl>(D)) {
738-
if (!VD->getBaseName().isSpecial())
739-
checkForForbiddenPrefix(VD->getBaseName().getIdentifier().str());
740-
}
741-
}
742735

743-
void TypeChecker::checkForForbiddenPrefix(const UnresolvedDeclRefExpr *E) {
744-
if (!hasEnabledForbiddenTypecheckPrefix())
736+
// Don't touch special names or empty names.
737+
if (Name.isSpecial() || Name.empty())
745738
return;
746-
if (!E->getName().isSpecial())
747-
checkForForbiddenPrefix(E->getName().getBaseIdentifier());
748-
}
749739

750-
void TypeChecker::checkForForbiddenPrefix(Identifier Ident) {
751-
if (!hasEnabledForbiddenTypecheckPrefix())
752-
return;
753-
checkForForbiddenPrefix(Ident.empty() ? StringRef() : Ident.str());
754-
}
755-
756-
void TypeChecker::checkForForbiddenPrefix(StringRef Name) {
757-
if (!hasEnabledForbiddenTypecheckPrefix())
758-
return;
759-
if (Name.empty())
760-
return;
761-
if (Name.startswith(Context.LangOpts.DebugForbidTypecheckPrefix)) {
740+
StringRef Str = Name.getIdentifier().str();
741+
if (Str.startswith(C.LangOpts.DebugForbidTypecheckPrefix)) {
762742
std::string Msg = "forbidden typecheck occurred: ";
763-
Msg += Name;
743+
Msg += Str;
764744
llvm::report_fatal_error(Msg);
765745
}
766746
}

trunk/lib/Sema/TypeChecker.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,16 +1883,9 @@ class TypeChecker final : public LazyResolver {
18831883
/// @}
18841884

18851885
/// If LangOptions::DebugForbidTypecheckPrefix is set and the given decl
1886-
/// has a name with that prefix, an llvm fatal_error is triggered.
1886+
/// name starts with that prefix, an llvm fatal_error is triggered.
18871887
/// This is for testing purposes.
1888-
void checkForForbiddenPrefix(const Decl *D);
1889-
void checkForForbiddenPrefix(const UnresolvedDeclRefExpr *E);
1890-
void checkForForbiddenPrefix(Identifier Ident);
1891-
void checkForForbiddenPrefix(StringRef Name);
1892-
1893-
bool hasEnabledForbiddenTypecheckPrefix() const {
1894-
return !Context.LangOpts.DebugForbidTypecheckPrefix.empty();
1895-
}
1888+
static void checkForForbiddenPrefix(ASTContext &C, DeclBaseName Name);
18961889

18971890
/// Check error handling in the given type-checked top-level code.
18981891
void checkTopLevelErrorHandling(TopLevelCodeDecl *D);

trunk/test/NameBinding/name_lookup.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,6 @@ _ = ShadowingGenericParameter<String>().foo(t: "hi")
614614
// rdar://problem/51266778
615615
struct PatternBindingWithTwoVars1 { var x = 3, y = x }
616616
// expected-error@-1 {{cannot use instance member 'x' within property initializer; property initializers run before 'self' is available}}
617-
// expected-error@-2 {{property 'x' references itself}}
618617

619618
struct PatternBindingWithTwoVars2 { var x = y, y = 3 }
620619
// expected-error@-1 {{property 'y' references itself}}

trunk/test/Profiler/coverage_var_init.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_var_init %s | %FileCheck %s
22

33
final class VarInit {
4-
// CHECK: sil_coverage_map {{.*}} "$s17coverage_var_init7VarInitC018initializedWrapperE0SivpfP"
5-
// CHECK-NEXT: [[@LINE+1]]:4 -> [[@LINE+1]]:38 : 0
6-
@Wrapper var initializedWrapperInit = 2
7-
84
// CHECK: sil_coverage_map {{.*}} "$s17coverage_var_init7VarInitC04lazydE033_49373CB2DFB47C8DC62FA963604688DFLLSSvgSSyXEfU_"
95
// CHECK-NEXT: [[@LINE+1]]:42 -> [[@LINE+3]]:4 : 0
106
private lazy var lazyVarInit: String = {
@@ -27,13 +23,7 @@ final class VarInit {
2723
print(lazyVarInit)
2824
print(basicVarInit)
2925
print(simpleVar)
30-
print(initializedWrapperInit)
3126
}
3227
}
3328

34-
@propertyWrapper struct Wrapper {
35-
init(wrappedValue: Int) {}
36-
var wrappedValue: Int { 1 }
37-
}
38-
3929
VarInit().coverageFunction()

trunk/utils/build-script-impl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3054,7 +3054,7 @@ for host in "${ALL_HOSTS[@]}"; do
30543054
results_dir="${lldb_build_dir}/test-results"
30553055

30563056
call mkdir -p "${results_dir}"
3057-
LLVM_LIT_ARGS="${LLVM_LIT_ARGS} --xunit-xml-output=${results_dir}/results.xml"
3057+
LLVM_LIT_ARG="${LLVM_LIT_ARGS} --xunit-xml-output=${results_dir}/results.xml"
30583058

30593059
if [[ "${ENABLE_ASAN}" ]] ; then
30603060
# Limit the number of parallel tests

0 commit comments

Comments
 (0)