Skip to content

Commit bd62aba

Browse files
authored
---
yaml --- r: 348914 b: refs/heads/master c: bc1a3ea h: refs/heads/master
1 parent ef3f671 commit bd62aba

File tree

78 files changed

+1048
-825
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1048
-825
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: 51476cde58d89b6abf5424e3c7c3f65606a74c45
2+
refs/heads/master: bc1a3eaaa5b213fd0f8d5679ac1f905208c44e83
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/cmake/modules/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ set(SWIFT_LIBRARY_DIRS ${SWIFT_LIBRARY_OUTPUT_INTDIR})
1616
configure_file(
1717
SwiftConfig.cmake.in
1818
${swift_cmake_builddir}/SwiftConfig.cmake
19-
@ONLY)
19+
@ONLY)

trunk/cmake/modules/SwiftConfig.cmake.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ set(SWIFT_VERSION @SWIFT_VERSION@)
66
set(SWIFT_MAIN_SRC_DIR @SWIFT_SOURCE_DIR@)
77

88
set(SWIFT_INCLUDE_DIRS "@SWIFT_INCLUDE_DIRS@")
9-
set(SWIFT_LIBRARY_DIRS "@SWIFT_CONFIG_LIBRARY_DIRS@")
9+
set(SWIFT_LIBRARY_DIRS "@SWIFT_LIBRARY_DIRS@")
1010

1111
# These variables are duplicated, but they must match the LLVM variables of the
1212
# same name. The variables ending in "S" could some day become lists, and are
1313
# preserved for convention and compatibility.
1414
set(SWIFT_INCLUDE_DIR "@SWIFT_INCLUDE_DIRS@")
15-
set(SWIFT_LIBRARY_DIR "@SWIFT_CONFIG_LIBRARY_DIRS@")
15+
set(SWIFT_LIBRARY_DIR "@SWIFT_LIBRARY_DIRS@")
1616

1717
set(SWIFT_CMAKE_DIR "@SWIFT_CMAKE_DIR@")
1818
set(SWIFT_BINARY_DIR "@SWIFT_BINARY_DIR@")

trunk/include/swift/AST/Decl.h

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class alignas(1 << DeclAlignInBits) Decl {
388388
SWIFT_INLINE_BITFIELD(SubscriptDecl, VarDecl, 2,
389389
StaticSpelling : 2
390390
);
391-
SWIFT_INLINE_BITFIELD(AbstractFunctionDecl, ValueDecl, 3+8+1+1+1+1+1+1+1+1,
391+
SWIFT_INLINE_BITFIELD(AbstractFunctionDecl, ValueDecl, 3+8+1+1+1+1+1+1,
392392
/// \see AbstractFunctionDecl::BodyKind
393393
BodyKind : 3,
394394

@@ -404,12 +404,6 @@ class alignas(1 << DeclAlignInBits) Decl {
404404
/// Whether the function body throws.
405405
Throws : 1,
406406

407-
/// Whether this function requires a new vtable entry.
408-
NeedsNewVTableEntry : 1,
409-
410-
/// Whether NeedsNewVTableEntry is valid.
411-
HasComputedNeedsNewVTableEntry : 1,
412-
413407
/// Whether this member was synthesized as part of a derived
414408
/// protocol conformance.
415409
Synthesized : 1,
@@ -3547,8 +3541,6 @@ class EnumDecl final : public NominalTypeDecl {
35473541
return SourceRange(EnumLoc, getBraces().End);
35483542
}
35493543

3550-
EnumElementDecl *getElement(Identifier Name) const;
3551-
35523544
public:
35533545
/// A range for iterating the elements of an enum.
35543546
using ElementRange = DowncastFilterRange<EnumElementDecl, DeclRange>;
@@ -5553,6 +5545,8 @@ class ImportAsMemberStatus {
55535545

55545546
/// Base class for function-like declarations.
55555547
class AbstractFunctionDecl : public GenericContext, public ValueDecl {
5548+
friend class NeedsNewVTableEntryRequest;
5549+
55565550
public:
55575551
enum class BodyKind {
55585552
/// The function did not have a body in the source code file.
@@ -5622,6 +5616,11 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
56225616
/// Location of the 'throws' token.
56235617
SourceLoc ThrowsLoc;
56245618

5619+
struct {
5620+
unsigned NeedsNewVTableEntryComputed : 1;
5621+
unsigned NeedsNewVTableEntry : 1;
5622+
} LazySemanticInfo = { };
5623+
56255624
AbstractFunctionDecl(DeclKind Kind, DeclContext *Parent, DeclName Name,
56265625
SourceLoc NameLoc, bool Throws, SourceLoc ThrowsLoc,
56275626
bool HasImplicitSelfDecl,
@@ -5633,8 +5632,6 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
56335632
Bits.AbstractFunctionDecl.HasImplicitSelfDecl = HasImplicitSelfDecl;
56345633
Bits.AbstractFunctionDecl.Overridden = false;
56355634
Bits.AbstractFunctionDecl.Throws = Throws;
5636-
Bits.AbstractFunctionDecl.NeedsNewVTableEntry = false;
5637-
Bits.AbstractFunctionDecl.HasComputedNeedsNewVTableEntry = false;
56385635
Bits.AbstractFunctionDecl.Synthesized = false;
56395636
Bits.AbstractFunctionDecl.HasSingleExpressionBody = false;
56405637
}
@@ -5804,16 +5801,9 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
58045801
return getBodyKind() == BodyKind::MemberwiseInitializer;
58055802
}
58065803

5807-
void setNeedsNewVTableEntry(bool value) {
5808-
Bits.AbstractFunctionDecl.HasComputedNeedsNewVTableEntry = true;
5809-
Bits.AbstractFunctionDecl.NeedsNewVTableEntry = value;
5810-
}
5811-
5812-
bool needsNewVTableEntry() const {
5813-
if (!Bits.AbstractFunctionDecl.HasComputedNeedsNewVTableEntry)
5814-
const_cast<AbstractFunctionDecl *>(this)->computeNeedsNewVTableEntry();
5815-
return Bits.AbstractFunctionDecl.NeedsNewVTableEntry;
5816-
}
5804+
/// For a method of a class, checks whether it will require a new entry in the
5805+
/// vtable.
5806+
bool needsNewVTableEntry() const;
58175807

58185808
bool isEffectiveLinkageMoreVisibleThan(ValueDecl *other) const {
58195809
return (std::min(getEffectiveAccess(), AccessLevel::Public) >
@@ -6363,13 +6353,7 @@ class EnumElementDecl : public DeclContext, public ValueDecl {
63636353
ParameterList *Params,
63646354
SourceLoc EqualsLoc,
63656355
LiteralExpr *RawValueExpr,
6366-
DeclContext *DC)
6367-
: DeclContext(DeclContextKind::EnumElementDecl, DC),
6368-
ValueDecl(DeclKind::EnumElement, DC, Name, IdentifierLoc),
6369-
Params(Params),
6370-
EqualsLoc(EqualsLoc),
6371-
RawValueExpr(RawValueExpr)
6372-
{}
6356+
DeclContext *DC);
63736357

63746358
Identifier getName() const { return getFullName().getBaseIdentifier(); }
63756359

@@ -6385,6 +6369,7 @@ class EnumElementDecl : public DeclContext, public ValueDecl {
63856369

63866370
Type getArgumentInterfaceType() const;
63876371

6372+
void setParameterList(ParameterList *params);
63886373
ParameterList *getParameterList() const { return Params; }
63896374

63906375
/// Retrieves a fully typechecked raw value expression associated

trunk/include/swift/AST/TypeCheckRequests.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,27 @@ class IsStaticRequest :
13141314
void cacheResult(bool value) const;
13151315
};
13161316

1317+
class NeedsNewVTableEntryRequest
1318+
: public SimpleRequest<NeedsNewVTableEntryRequest,
1319+
bool(AbstractFunctionDecl *),
1320+
CacheKind::SeparatelyCached> {
1321+
public:
1322+
using SimpleRequest::SimpleRequest;
1323+
1324+
private:
1325+
friend SimpleRequest;
1326+
1327+
// Evaluation.
1328+
llvm::Expected<bool> evaluate(Evaluator &evaluator,
1329+
AbstractFunctionDecl *decl) const;
1330+
1331+
public:
1332+
// Separate caching.
1333+
bool isCached() const { return true; }
1334+
Optional<bool> getCachedResult() const;
1335+
void cacheResult(bool value) const;
1336+
};
1337+
13171338
// Allow AnyValue to compare two Type values, even though Type doesn't
13181339
// support ==.
13191340
template<>

trunk/include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,5 @@ SWIFT_REQUEST(TypeChecker, IsABICompatibleOverrideRequest,
149149
bool(ValueDecl *), Cached, NoLocationInfo)
150150
SWIFT_REQUEST(TypeChecker, IsStaticRequest,
151151
bool(FuncDecl *), SeparatelyCached, NoLocationInfo)
152+
SWIFT_REQUEST(TypeChecker, NeedsNewVTableEntryRequest,
153+
bool(AbstractFunctionDecl *), SeparatelyCached, NoLocationInfo)

trunk/include/swift/AST/USRGeneration.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
1111
//===----------------------------------------------------------------------===//
12+
//
13+
// Unique Symbol References (USRs) provide a textual encoding for
14+
// declarations. These are used for indexing, analogous to how mangled names
15+
// are used in object files.
16+
//
17+
//===----------------------------------------------------------------------===//
1218

1319
#ifndef SWIFT_AST_USRGENERATION_H
1420
#define SWIFT_AST_USRGENERATION_H

trunk/include/swift/Basic/StringExtras.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "swift/Basic/LLVM.h"
2222
#include "swift/Basic/OptionSet.h"
2323
#include "llvm/ADT/SmallVector.h"
24-
#include "llvm/ADT/StringMap.h"
2524
#include "llvm/ADT/StringRef.h"
2625
#include "llvm/ADT/StringSet.h"
2726
#include "llvm/Support/Allocator.h"
@@ -65,6 +64,8 @@ namespace swift {
6564

6665
public:
6766
StringRef copyString(StringRef string);
67+
68+
llvm::BumpPtrAllocator &getAllocator() { return Allocator; }
6869
};
6970

7071
namespace camel_case {
@@ -430,11 +431,13 @@ StringRef matchLeadingTypeName(StringRef name, OmissionTypeName typeName);
430431
/// Describes a set of names with an inheritance relationship.
431432
class InheritedNameSet {
432433
const InheritedNameSet *Parent;
433-
llvm::StringSet<> Names;
434+
llvm::StringSet<llvm::BumpPtrAllocator &> Names;
434435

435436
public:
436437
/// Construct a new inherited name set with the given parent.
437-
explicit InheritedNameSet(const InheritedNameSet *parent) : Parent(parent) { }
438+
InheritedNameSet(const InheritedNameSet *parent,
439+
llvm::BumpPtrAllocator &allocator)
440+
: Parent(parent), Names(allocator) { }
438441

439442
// Add a new name to the set.
440443
void add(StringRef name);

trunk/include/swift/Parse/ASTGen.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ class ASTGen {
7979
//===--------------------------------------------------------------------===//
8080
// Expressions.
8181

82+
Expr *generate(const syntax::ExprSyntax &Expr, const SourceLoc Loc);
83+
Expr *generate(const syntax::IdentifierExprSyntax &Expr, const SourceLoc Loc);
84+
Expr *generate(const syntax::EditorPlaceholderExprSyntax &Expr,
85+
const SourceLoc Loc);
86+
Expr *generate(const syntax::SpecializeExprSyntax &Expr, const SourceLoc Loc);
8287
Expr *generate(const syntax::IntegerLiteralExprSyntax &Expr,
8388
const SourceLoc Loc);
8489
Expr *generate(const syntax::FloatLiteralExprSyntax &Expr,
@@ -96,7 +101,13 @@ class ASTGen {
96101
const SourceLoc Loc);
97102
Expr *generate(const syntax::UnknownExprSyntax &Expr, const SourceLoc Loc);
98103

104+
std::pair<DeclName, DeclNameLoc> generateUnqualifiedDeclName(
105+
const syntax::TokenSyntax &idTok,
106+
const Optional<syntax::DeclNameArgumentsSyntax> &args,
107+
const SourceLoc Loc);
108+
99109
private:
110+
100111
Expr *generateMagicIdentifierLiteralExpression(
101112
const syntax::TokenSyntax &PoundToken, const SourceLoc Loc);
102113

@@ -168,10 +179,9 @@ class ASTGen {
168179
//===--------------------------------------------------------------------===//
169180
// Generics.
170181

171-
TypeRepr *generate(const syntax::GenericArgumentSyntax &Arg,
172-
const SourceLoc Loc);
173-
llvm::SmallVector<TypeRepr *, 4>
174-
generate(const syntax::GenericArgumentListSyntax &Args, const SourceLoc Loc);
182+
void generate(const syntax::GenericArgumentClauseSyntax &Arg,
183+
const SourceLoc Loc, SourceLoc &lAngleLoc, SourceLoc &rAngleLoc,
184+
SmallVectorImpl<TypeRepr *> &args);
175185

176186
GenericParamList *
177187
generate(const syntax::GenericParameterClauseListSyntax &clause,

trunk/include/swift/Parse/Parser.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,8 @@ class Parser {
14801480
/// _)
14811481
/// \param loc The location of the label (empty if it doesn't exist)
14821482
void parseOptionalArgumentLabel(Identifier &name, SourceLoc &loc);
1483+
bool parseOptionalArgumentLabelSyntax(Optional<ParsedTokenSyntax> &name,
1484+
Optional<ParsedTokenSyntax> &colon);
14831485

14841486
/// Parse an unqualified-decl-name.
14851487
///
@@ -1498,10 +1500,20 @@ class Parser {
14981500
bool allowOperators=false,
14991501
bool allowZeroArgCompoundNames=false,
15001502
bool allowDeinitAndSubscript=false);
1503+
ParserStatus
1504+
parseUnqualifiedDeclNameSyntax(Optional<ParsedTokenSyntax> &identTok,
1505+
Optional<ParsedDeclNameArgumentsSyntax> &declNameArg,
1506+
bool afterDot, const Diagnostic &diag,
1507+
bool allowOperators=false,
1508+
bool allowZeroArgCompoundNames=false,
1509+
bool allowDeinitAndSubscript=false);
1510+
1511+
ParsedSyntaxResult<ParsedExprSyntax> parseExprIdentifierSyntax();
1512+
ParsedSyntaxResult<ParsedExprSyntax>
1513+
parseExprSpecializeSyntax(ParsedExprSyntax &&);
15011514

15021515
Expr *parseExprIdentifier();
1503-
Expr *parseExprEditorPlaceholder(Token PlaceholderTok,
1504-
Identifier PlaceholderId);
1516+
Expr *parseExprEditorPlaceholder(SourceLoc loc, StringRef text);
15051517

15061518
/// Parse a closure expression after the opening brace.
15071519
///

trunk/include/swift/SIL/SILConstants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ class SymbolicValue {
556556
void dump() const;
557557
};
558558

559-
static_assert(sizeof(SymbolicValue) == 2 * sizeof(void *),
559+
static_assert(sizeof(SymbolicValue) == 2 * sizeof(uint64_t),
560560
"SymbolicValue should stay small");
561561
static_assert(std::is_pod<SymbolicValue>::value,
562562
"SymbolicValue should stay POD");

trunk/lib/AST/ASTMangler.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2372,13 +2372,9 @@ CanType ASTMangler::getDeclTypeForMangling(
23722372
}
23732373

23742374

2375-
Type type = decl->getInterfaceType()
2376-
->getReferenceStorageReferent();
2377-
if (type->hasArchetype()) {
2378-
assert(isa<ParamDecl>(decl) && "Only ParamDecl's still have archetypes");
2379-
type = type->mapTypeOutOfContext();
2380-
}
2381-
CanType canTy = type->getCanonicalType();
2375+
auto canTy = decl->getInterfaceType()
2376+
->getReferenceStorageReferent()
2377+
->getCanonicalType();
23822378

23832379
if (auto gft = dyn_cast<GenericFunctionType>(canTy)) {
23842380
genericSig = gft.getGenericSignature();

0 commit comments

Comments
 (0)