Skip to content

Commit 7a0942e

Browse files
committed
---
yaml --- r: 348830 b: refs/heads/master c: d2971fa h: refs/heads/master
1 parent e3e15f2 commit 7a0942e

19 files changed

+117
-157
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: dbddb0d89aa3dc94fdde427a93a0598b661bca0c
2+
refs/heads/master: d2971fa1a06149652b9b675a475b42af31bc376d
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/AST/AnyRequest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class AnyRequest {
5454
friend llvm::DenseMapInfo<swift::AnyRequest>;
5555

5656
static hash_code hashForHolder(uint64_t typeID, hash_code requestHash) {
57-
return hash_combine(typeID, requestHash);
57+
return hash_combine(hash_value(typeID), requestHash);
5858
}
5959

6060
/// Abstract base class used to hold the specific request kind.

trunk/include/swift/AST/SearchPathOptions.h

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#ifndef SWIFT_AST_SEARCHPATHOPTIONS_H
1414
#define SWIFT_AST_SEARCHPATHOPTIONS_H
1515

16-
#include "swift/Basic/ArrayRefView.h"
1716
#include "llvm/ADT/Hashing.h"
1817

1918
#include <string>
@@ -82,38 +81,30 @@ class SearchPathOptions {
8281
/// would for a non-system header.
8382
bool DisableModulesValidateSystemDependencies = false;
8483

85-
private:
86-
static StringRef
87-
pathStringFromFrameworkSearchPath(const FrameworkSearchPath &next) {
88-
return next.Path;
89-
};
90-
91-
public:
9284
/// Return a hash code of any components from these options that should
9385
/// contribute to a Swift Bridging PCH hash.
9486
llvm::hash_code getPCHHashComponents() const {
87+
using llvm::hash_value;
9588
using llvm::hash_combine;
96-
using llvm::hash_combine_range;
97-
98-
using FrameworkPathView = ArrayRefView<FrameworkSearchPath, StringRef,
99-
pathStringFromFrameworkSearchPath>;
100-
FrameworkPathView frameworkPathsOnly{FrameworkSearchPaths};
101-
102-
return hash_combine(SDKPath,
103-
hash_combine_range(ImportSearchPaths.begin(),
104-
ImportSearchPaths.end()),
105-
hash_combine_range(VFSOverlayFiles.begin(),
106-
VFSOverlayFiles.end()),
107-
// FIXME: Should we include the system-ness of framework
108-
// search paths too?
109-
hash_combine_range(frameworkPathsOnly.begin(),
110-
frameworkPathsOnly.end()),
111-
hash_combine_range(LibrarySearchPaths.begin(),
112-
LibrarySearchPaths.end()),
113-
RuntimeResourcePath,
114-
hash_combine_range(RuntimeLibraryImportPaths.begin(),
115-
RuntimeLibraryImportPaths.end()),
116-
DisableModulesValidateSystemDependencies);
89+
auto Code = hash_value(SDKPath);
90+
for (auto Import : ImportSearchPaths) {
91+
Code = hash_combine(Code, Import);
92+
}
93+
for (auto VFSFile : VFSOverlayFiles) {
94+
Code = hash_combine(Code, VFSFile);
95+
}
96+
for (const auto &FrameworkPath : FrameworkSearchPaths) {
97+
Code = hash_combine(Code, FrameworkPath.Path);
98+
}
99+
for (auto LibraryPath : LibrarySearchPaths) {
100+
Code = hash_combine(Code, LibraryPath);
101+
}
102+
Code = hash_combine(Code, RuntimeResourcePath);
103+
for (auto RuntimeLibraryImportPath : RuntimeLibraryImportPaths) {
104+
Code = hash_combine(Code, RuntimeLibraryImportPath);
105+
}
106+
Code = hash_combine(Code, DisableModulesValidateSystemDependencies);
107+
return Code;
117108
}
118109
};
119110

trunk/include/swift/AST/TypeCheckRequests.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ struct WhereClauseOwner {
380380
SourceLoc getLoc() const;
381381

382382
friend hash_code hash_value(const WhereClauseOwner &owner) {
383-
return llvm::hash_combine(owner.dc, owner.source.getOpaqueValue());
383+
return hash_combine(hash_value(owner.dc),
384+
hash_value(owner.source.getOpaqueValue()));
384385
}
385386

386387
friend bool operator==(const WhereClauseOwner &lhs,

trunk/include/swift/AST/TypeLoc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ struct TypeLoc {
6868
TypeLoc clone(ASTContext &ctx) const;
6969

7070
friend llvm::hash_code hash_value(const TypeLoc &owner) {
71-
return llvm::hash_combine(owner.Ty.getPointer(), owner.TyR);
71+
return hash_combine(llvm::hash_value(owner.Ty.getPointer()),
72+
llvm::hash_value(owner.TyR));
7273
}
7374

7475
friend bool operator==(const TypeLoc &lhs,

trunk/include/swift/Basic/LangOptions.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,12 @@ namespace swift {
441441
/// Return a hash code of any components from these options that should
442442
/// contribute to a Swift Bridging PCH hash.
443443
llvm::hash_code getPCHHashComponents() const {
444+
auto code = llvm::hash_value(Target.str());
444445
SmallString<16> Scratch;
445446
llvm::raw_svector_ostream OS(Scratch);
446447
OS << EffectiveLanguageVersion;
447-
return llvm::hash_combine(Target.str(), OS.str());
448+
code = llvm::hash_combine(code, OS.str());
449+
return code;
448450
}
449451

450452
private:

trunk/include/swift/Basic/SourceLoc.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,10 @@ template <> struct DenseMapInfo<swift::SourceRange> {
265265
}
266266

267267
static unsigned getHashValue(const swift::SourceRange &Val) {
268-
return hash_combine(Val.Start.getOpaquePointerValue(),
269-
Val.End.getOpaquePointerValue());
268+
return hash_combine(DenseMapInfo<const void *>::getHashValue(
269+
Val.Start.getOpaquePointerValue()),
270+
DenseMapInfo<const void *>::getHashValue(
271+
Val.End.getOpaquePointerValue()));
270272
}
271273

272274
static bool isEqual(const swift::SourceRange &LHS,

trunk/include/swift/ClangImporter/ClangImporterOptions.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,23 @@ class ClangImporterOptions {
9999
/// Return a hash code of any components from these options that should
100100
/// contribute to a Swift Bridging PCH hash.
101101
llvm::hash_code getPCHHashComponents() const {
102+
using llvm::hash_value;
102103
using llvm::hash_combine;
103-
using llvm::hash_combine_range;
104-
105-
return hash_combine(ModuleCachePath,
106-
hash_combine_range(ExtraArgs.begin(), ExtraArgs.end()),
107-
OverrideResourceDir,
108-
TargetCPU,
109-
BridgingHeader,
110-
PrecompiledHeaderOutputDir,
111-
static_cast<uint8_t>(Mode),
112-
DetailedPreprocessingRecord,
113-
ImportForwardDeclarations,
114-
InferImportAsMember,
115-
DisableSwiftBridgeAttr,
116-
DisableOverlayModules);
104+
105+
auto Code = hash_value(ModuleCachePath);
106+
Code = hash_combine(Code, llvm::hash_combine_range(ExtraArgs.begin(),
107+
ExtraArgs.end()));
108+
Code = hash_combine(Code, OverrideResourceDir);
109+
Code = hash_combine(Code, TargetCPU);
110+
Code = hash_combine(Code, BridgingHeader);
111+
Code = hash_combine(Code, PrecompiledHeaderOutputDir);
112+
Code = hash_combine(Code, static_cast<uint8_t>(Mode));
113+
Code = hash_combine(Code, DetailedPreprocessingRecord);
114+
Code = hash_combine(Code, ImportForwardDeclarations);
115+
Code = hash_combine(Code, InferImportAsMember);
116+
Code = hash_combine(Code, DisableSwiftBridgeAttr);
117+
Code = hash_combine(Code, DisableOverlayModules);
118+
return Code;
117119
}
118120
};
119121

trunk/include/swift/IDE/IDERequests.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ struct CursorInfoOwner {
3838
CursorInfoOwner(SourceFile *File, SourceLoc Loc): File(File), Loc(Loc) { }
3939

4040
friend llvm::hash_code hash_value(const CursorInfoOwner &CI) {
41-
return llvm::hash_combine(CI.File, CI.Loc.getOpaquePointerValue());
41+
return hash_combine(hash_value(CI.File),
42+
hash_value(CI.Loc.getOpaquePointerValue()));
4243
}
4344

4445
friend bool operator==(const CursorInfoOwner &lhs, const CursorInfoOwner &rhs) {
@@ -96,9 +97,9 @@ struct RangeInfoOwner {
9697
RangeInfoOwner(SourceFile *File, unsigned Offset, unsigned Length);
9798

9899
friend llvm::hash_code hash_value(const RangeInfoOwner &CI) {
99-
return llvm::hash_combine(CI.File,
100-
CI.StartLoc.getOpaquePointerValue(),
101-
CI.EndLoc.getOpaquePointerValue());
100+
return hash_combine(hash_value(CI.File),
101+
hash_value(CI.StartLoc.getOpaquePointerValue()),
102+
hash_value(CI.EndLoc.getOpaquePointerValue()));
102103
}
103104

104105
friend bool operator==(const RangeInfoOwner &lhs, const RangeInfoOwner &rhs) {
@@ -182,9 +183,9 @@ struct OverridenDeclsOwner {
182183
Transitive(Transitive) {}
183184

184185
friend llvm::hash_code hash_value(const OverridenDeclsOwner &CI) {
185-
return llvm::hash_combine(CI.VD,
186-
CI.IncludeProtocolRequirements,
187-
CI.Transitive);
186+
return hash_combine(hash_value(CI.VD),
187+
hash_value(CI.IncludeProtocolRequirements),
188+
hash_value(CI.Transitive));
188189
}
189190

190191
friend bool operator==(const OverridenDeclsOwner &lhs,

trunk/include/swift/Sema/IDETypeCheckingRequests.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ struct DeclApplicabilityOwner {
3838
DC(DC), Ty(Ty), ExtensionOrMember(VD) {}
3939

4040
friend llvm::hash_code hash_value(const DeclApplicabilityOwner &CI) {
41-
return llvm::hash_combine(CI.Ty.getPointer(), CI.ExtensionOrMember);
41+
return hash_combine(hash_value(CI.Ty.getPointer()),
42+
hash_value(CI.ExtensionOrMember));
4243
}
4344

4445
friend bool operator==(const DeclApplicabilityOwner &lhs,
@@ -95,8 +96,8 @@ struct TypePair {
9596
TypePair(Type FirstTy, Type SecondTy): FirstTy(FirstTy), SecondTy(SecondTy) {}
9697
TypePair(): TypePair(Type(), Type()) {}
9798
friend llvm::hash_code hash_value(const TypePair &TI) {
98-
return llvm::hash_combine(TI.FirstTy.getPointer(),
99-
TI.SecondTy.getPointer());
99+
return hash_combine(hash_value(TI.FirstTy.getPointer()),
100+
hash_value(TI.SecondTy.getPointer()));
100101
}
101102

102103
friend bool operator==(const TypePair &lhs,
@@ -132,7 +133,9 @@ struct TypeRelationCheckInput {
132133
OpenArchetypes(OpenArchetypes) {}
133134

134135
friend llvm::hash_code hash_value(const TypeRelationCheckInput &TI) {
135-
return llvm::hash_combine(TI.Pair, TI.Relation, TI.OpenArchetypes);
136+
return hash_combine(hash_value(TI.Pair),
137+
hash_value(TI.Relation),
138+
hash_value(TI.OpenArchetypes));
136139
}
137140

138141
friend bool operator==(const TypeRelationCheckInput &lhs,

trunk/lib/Frontend/Frontend.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ CompilerInstance::CompilerInstance() = default;
4646
CompilerInstance::~CompilerInstance() = default;
4747

4848
std::string CompilerInvocation::getPCHHash() const {
49+
using llvm::hash_code;
50+
using llvm::hash_value;
4951
using llvm::hash_combine;
5052

51-
auto Code = hash_combine(LangOpts.getPCHHashComponents(),
52-
FrontendOpts.getPCHHashComponents(),
53-
ClangImporterOpts.getPCHHashComponents(),
54-
SearchPathOpts.getPCHHashComponents(),
55-
DiagnosticOpts.getPCHHashComponents(),
56-
SILOpts.getPCHHashComponents(),
57-
IRGenOpts.getPCHHashComponents());
53+
auto Code = hash_value(LangOpts.getPCHHashComponents());
54+
Code = hash_combine(Code, FrontendOpts.getPCHHashComponents());
55+
Code = hash_combine(Code, ClangImporterOpts.getPCHHashComponents());
56+
Code = hash_combine(Code, SearchPathOpts.getPCHHashComponents());
57+
Code = hash_combine(Code, DiagnosticOpts.getPCHHashComponents());
58+
Code = hash_combine(Code, SILOpts.getPCHHashComponents());
59+
Code = hash_combine(Code, IRGenOpts.getPCHHashComponents());
5860

5961
return llvm::APInt(64, Code).toString(36, /*Signed=*/false);
6062
}

trunk/lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -380,36 +380,34 @@ class ModuleInterfaceLoaderImpl {
380380
/// with dead entries -- when other factors change, such as the contents of
381381
/// the .swiftinterface input or its dependencies.
382382
std::string getCacheHash(const CompilerInvocation &SubInvocation) {
383+
// Start with the compiler version (which will be either tag names or revs).
384+
// Explicitly don't pass in the "effective" language version -- this would
385+
// mean modules built in different -swift-version modes would rebuild their
386+
// dependencies.
387+
llvm::hash_code H = hash_value(swift::version::getSwiftFullVersion());
388+
389+
// Simplest representation of input "identity" (not content) is just a
390+
// pathname, and probably all we can get from the VFS in this regard
391+
// anyways.
392+
H = hash_combine(H, interfacePath);
393+
394+
// Include the normalized target triple. In practice, .swiftinterface files
395+
// will be in target-specific subdirectories and would have
396+
// target-specific pieces #if'd out. However, it doesn't hurt to
397+
// include it, and it guards against mistakenly reusing cached modules
398+
// across targets. Note that this normalization explicitly doesn't
399+
// include the minimum deployment target (e.g. the '12.0' in 'ios12.0').
383400
auto normalizedTargetTriple =
384401
getTargetSpecificModuleTriple(SubInvocation.getLangOptions().Target);
402+
H = hash_combine(H, normalizedTargetTriple.str());
385403

386-
llvm::hash_code H = hash_combine(
387-
// Start with the compiler version (which will be either tag names or
388-
// revs). Explicitly don't pass in the "effective" language version --
389-
// this would mean modules built in different -swift-version modes would
390-
// rebuild their dependencies.
391-
swift::version::getSwiftFullVersion(),
392-
393-
// Simplest representation of input "identity" (not content) is just a
394-
// pathname, and probably all we can get from the VFS in this regard
395-
// anyways.
396-
interfacePath,
397-
398-
// Include the normalized target triple. In practice, .swiftinterface
399-
// files will be in target-specific subdirectories and would have
400-
// target-specific pieces #if'd out. However, it doesn't hurt to include
401-
// it, and it guards against mistakenly reusing cached modules across
402-
// targets. Note that this normalization explicitly doesn't include the
403-
// minimum deployment target (e.g. the '12.0' in 'ios12.0').
404-
normalizedTargetTriple.str(),
405-
406-
// The SDK path is going to affect how this module is imported, so
407-
// include it.
408-
SubInvocation.getSDKPath(),
409-
410-
// Whether or not we're tracking system dependencies affects the
411-
// invalidation behavior of this cache item.
412-
SubInvocation.getFrontendOptions().TrackSystemDeps);
404+
// The SDK path is going to affect how this module is imported, so include
405+
// it.
406+
H = hash_combine(H, SubInvocation.getSDKPath());
407+
408+
// Whether or not we're tracking system dependencies affects the
409+
// invalidation behavior of this cache item.
410+
H = hash_combine(H, SubInvocation.getFrontendOptions().TrackSystemDeps);
413411

414412
return llvm::APInt(64, H).toString(36, /*Signed=*/false);
415413
}

trunk/lib/Parse/ASTGen.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,9 @@ GenericParamList *ASTGen::generate(const GenericParameterClauseSyntax &clause,
976976
params.reserve(clause.getGenericParameterList().getNumChildren());
977977

978978
for (auto elem : clause.getGenericParameterList()) {
979+
auto nameTok = elem.getName();
980+
if (nameTok.isMissing())
981+
break;
979982

980983
DeclAttributes attrs = generateDeclAttributes(elem, Loc, false);
981984
Identifier name = Context.getIdentifier(elem.getName().getIdentifierText());

trunk/lib/Parse/ParseDecl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,6 +1632,9 @@ ParserStatus Parser::parseDeclAttribute(DeclAttributes &Attributes, SourceLoc At
16321632
}
16331633
consumeToken(tok::code_complete);
16341634
return makeParserCodeCompletionStatus();
1635+
} else {
1636+
// Synthesize an r_brace syntax node if the token is absent
1637+
SyntaxContext->synthesize(tok::identifier, AtLoc.getAdvancedLoc(1));
16351638
}
16361639

16371640
diagnose(Tok, diag::expected_attribute_name);

trunk/lib/Parse/ParseGeneric.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Parser::parseGenericParameterClauseSyntax() {
7474

7575
// Parse attributes.
7676
// TODO: Implement syntax attribute parsing.
77+
Optional<ParsedAttributeListSyntax> attrs;
7778
if (Tok.is(tok::at_sign)) {
7879
SyntaxParsingContext TmpCtxt(SyntaxContext);
7980
TmpCtxt.setTransparent();
@@ -83,18 +84,23 @@ Parser::parseGenericParameterClauseSyntax() {
8384
parseDeclAttributeList(attrsAST);
8485
if (!attrsAST.isEmpty())
8586
Generator.addDeclAttributes(attrsAST, AttrsLoc);
86-
auto attrs = SyntaxContext->popIf<ParsedAttributeListSyntax>();
87-
if (attrs)
88-
paramBuilder.useAttributes(std::move(*attrs));
87+
attrs = SyntaxContext->popIf<ParsedAttributeListSyntax>();
8988
}
9089

9190
// Parse the name of the parameter.
9291
auto ident = Context.getIdentifier(Tok.getText());
9392
auto name = parseIdentifierSyntax(diag::expected_generics_parameter_name);
9493
if (!name) {
94+
if (attrs) {
95+
paramBuilder.useAttributes(std::move(*attrs));
96+
builder.addGenericParameterListMember(paramBuilder.build());
97+
}
9598
status.setIsParseError();
9699
break;
97100
}
101+
102+
if (attrs)
103+
paramBuilder.useAttributes(std::move(*attrs));
98104
paramBuilder.useName(std::move(*name));
99105

100106
// Parse the ':' followed by a type.

trunk/lib/SILGen/SILGenLValue.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,14 +1430,7 @@ namespace {
14301430

14311431
// Create the allocating setter function. It captures the base address.
14321432
auto setterInfo = SGF.getConstantInfo(setter);
1433-
SILValue setterFRef;
1434-
if (setter.hasDecl() && setter.getDecl()->isObjCDynamic()) {
1435-
auto methodTy = SILType::getPrimitiveObjectType(
1436-
SGF.SGM.Types.getConstantFunctionType(setter));
1437-
setterFRef = SGF.B.createObjCMethod(
1438-
loc, base.getValue(), setter, methodTy);
1439-
} else
1440-
setterFRef = SGF.emitGlobalFunctionRef(loc, setter, setterInfo);
1433+
SILValue setterFRef = SGF.emitGlobalFunctionRef(loc, setter, setterInfo);
14411434
CanSILFunctionType setterTy = setterFRef->getType().castTo<SILFunctionType>();
14421435
SILFunctionConventions setterConv(setterTy, SGF.SGM.M);
14431436

0 commit comments

Comments
 (0)