Skip to content

Commit 2cce5a0

Browse files
committed
---
yaml --- r: 348906 b: refs/heads/master c: a6b5824 h: refs/heads/master
1 parent 79897d0 commit 2cce5a0

File tree

8 files changed

+40
-24
lines changed

8 files changed

+40
-24
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: 1d7d58a363a8ad1885d2c42a32738bfdf6933e43
2+
refs/heads/master: a6b5824dacb2660d285709451bc65b3df65362bc
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/Decl.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6355,13 +6355,7 @@ class EnumElementDecl : public DeclContext, public ValueDecl {
63556355
ParameterList *Params,
63566356
SourceLoc EqualsLoc,
63576357
LiteralExpr *RawValueExpr,
6358-
DeclContext *DC)
6359-
: DeclContext(DeclContextKind::EnumElementDecl, DC),
6360-
ValueDecl(DeclKind::EnumElement, DC, Name, IdentifierLoc),
6361-
Params(Params),
6362-
EqualsLoc(EqualsLoc),
6363-
RawValueExpr(RawValueExpr)
6364-
{}
6358+
DeclContext *DC);
63656359

63666360
Identifier getName() const { return getFullName().getBaseIdentifier(); }
63676361

@@ -6377,6 +6371,7 @@ class EnumElementDecl : public DeclContext, public ValueDecl {
63776371

63786372
Type getArgumentInterfaceType() const;
63796373

6374+
void setParameterList(ParameterList *params);
63806375
ParameterList *getParameterList() const { return Params; }
63816376

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

trunk/lib/AST/Decl.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7070,6 +7070,18 @@ SourceRange FuncDecl::getSourceRange() const {
70707070
return StartLoc;
70717071
}
70727072

7073+
EnumElementDecl::EnumElementDecl(SourceLoc IdentifierLoc, DeclName Name,
7074+
ParameterList *Params,
7075+
SourceLoc EqualsLoc,
7076+
LiteralExpr *RawValueExpr,
7077+
DeclContext *DC)
7078+
: DeclContext(DeclContextKind::EnumElementDecl, DC),
7079+
ValueDecl(DeclKind::EnumElement, DC, Name, IdentifierLoc),
7080+
EqualsLoc(EqualsLoc),
7081+
RawValueExpr(RawValueExpr) {
7082+
setParameterList(Params);
7083+
}
7084+
70737085
SourceRange EnumElementDecl::getSourceRange() const {
70747086
if (RawValueExpr && !RawValueExpr->isImplicit())
70757087
return {getStartLoc(), RawValueExpr->getEndLoc()};
@@ -7127,6 +7139,13 @@ Type EnumElementDecl::getArgumentInterfaceType() const {
71277139
return TupleType::get(elements, ctx);
71287140
}
71297141

7142+
void EnumElementDecl::setParameterList(ParameterList *params) {
7143+
Params = params;
7144+
7145+
if (params)
7146+
params->setDeclContextOfParamDecls(this);
7147+
}
7148+
71307149
EnumCaseDecl *EnumElementDecl::getParentCase() const {
71317150
for (EnumCaseDecl *EC : getParentEnum()->getAllCases()) {
71327151
ArrayRef<EnumElementDecl *> CaseElements = EC->getElements();

trunk/lib/AST/UnqualifiedLookup.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,8 @@ void UnqualifiedLookupFactory::lookupNamesIntroducedByMiscContext(
778778
assert(isa<TopLevelCodeDecl>(dc) ||
779779
isa<Initializer>(dc) ||
780780
isa<TypeAliasDecl>(dc) ||
781-
isa<SubscriptDecl>(dc));
781+
isa<SubscriptDecl>(dc) ||
782+
isa<EnumElementDecl>(dc));
782783
finishLookingInContext(
783784
AddGenericParameters::Yes,
784785
dc,

trunk/lib/Serialization/Deserialization.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,6 +1874,8 @@ DeclContext *ModuleFile::getDeclContext(DeclContextID DCID) {
18741874
return AFD;
18751875
if (auto SD = dyn_cast<SubscriptDecl>(D))
18761876
return SD;
1877+
if (auto EED = dyn_cast<EnumElementDecl>(D))
1878+
return EED;
18771879

18781880
llvm_unreachable("Unknown Decl : DeclContext kind");
18791881
}
@@ -3554,24 +3556,24 @@ class swift::DeclDeserializer {
35543556
}
35553557
}
35563558

3557-
// Read payload parameter list, if it exists.
3558-
ParameterList *paramList = nullptr;
3559-
if (hasPayload) {
3560-
paramList = MF.readParameterList();
3561-
}
3562-
35633559
DeclContext *DC = MF.getDeclContext(contextID);
35643560
if (declOrOffset.isComplete())
35653561
return declOrOffset;
35663562

35673563
auto elem = MF.createDecl<EnumElementDecl>(SourceLoc(),
35683564
name,
3569-
paramList,
3565+
nullptr,
35703566
SourceLoc(),
35713567
nullptr,
35723568
DC);
35733569
declOrOffset = elem;
35743570

3571+
// Read payload parameter list, if it exists.
3572+
if (hasPayload) {
3573+
auto *paramList = MF.readParameterList();
3574+
elem->setParameterList(paramList);
3575+
}
3576+
35753577
// Deserialize the literal raw value, if any.
35763578
switch ((EnumElementRawValueKind)rawValueKindID) {
35773579
case EnumElementRawValueKind::None:

trunk/lib/Serialization/Serialization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ static ASTContext &getContext(ModuleOrSourceFile DC) {
439439

440440
static bool shouldSerializeAsLocalContext(const DeclContext *DC) {
441441
return DC->isLocalContext() && !isa<AbstractFunctionDecl>(DC) &&
442-
!isa<SubscriptDecl>(DC);
442+
!isa<SubscriptDecl>(DC) && !isa<EnumElementDecl>(DC);
443443
}
444444

445445
namespace {

trunk/test/IDE/comment_attach.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,10 @@ func unterminatedBlockDocComment() {}
293293
// CHECK-NEXT: comment_attach.swift:166:6: Enum/decl_enum_1 RawComment=[/// decl_enum_1 Aaa.\n]
294294
// CHECK-NEXT: comment_attach.swift:168:8: EnumElement/decl_enum_1.Case1 RawComment=[/// Case1 Aaa.\n]
295295
// CHECK-NEXT: comment_attach.swift:171:8: EnumElement/decl_enum_1.Case2 RawComment=[/// Case2 Aaa.\n]
296-
// CHECK-NEXT: Param/decl_enum_1.<anonymous> RawComment=none BriefComment=none DocCommentAsXML=none
296+
// CHECK-NEXT: Param/<anonymous> RawComment=none BriefComment=none DocCommentAsXML=none
297297
// CHECK-NEXT: comment_attach.swift:174:8: EnumElement/decl_enum_1.Case3 RawComment=[/// Case3 Aaa.\n]
298-
// CHECK-NEXT: Param/decl_enum_1.<anonymous> RawComment=none BriefComment=none DocCommentAsXML=none
299-
// CHECK-NEXT: Param/decl_enum_1.<anonymous> RawComment=none BriefComment=none DocCommentAsXML=none
298+
// CHECK-NEXT: Param/<anonymous> RawComment=none BriefComment=none DocCommentAsXML=none
299+
// CHECK-NEXT: Param/<anonymous> RawComment=none BriefComment=none DocCommentAsXML=none
300300
// CHECK-NEXT: comment_attach.swift:177:8: EnumElement/decl_enum_1.Case4 RawComment=[/// Case4 Case5 Aaa.\n]
301301
// CHECK-NEXT: comment_attach.swift:177:15: EnumElement/decl_enum_1.Case5 RawComment=[/// Case4 Case5 Aaa.\n]
302302
// CHECK-NEXT: comment_attach.swift:181:7: Class/decl_class_1 RawComment=[/// decl_class_1 Aaa.\n]

trunk/utils/build-script-impl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3453,7 +3453,7 @@ for host in "${ALL_HOSTS[@]}"; do
34533453
if [ "${BUILD_LIBPARSER_ONLY}" ]; then
34543454
# We don't have a toolchain so we should install to the specified dir
34553455
DYLIB_DIR="${INSTALL_DESTDIR}"
3456-
MODULE_DIR="${INSTALL_DESTDIR}/${product}.swiftmodule"
3456+
MODULE_DIR="${INSTALL_DESTDIR}/${product}.swiftmodule/${SWIFT_HOST_VARIANT_ARCH}"
34573457
# Create the install dir if it doesn't exist
34583458
call mkdir -p "${INSTALL_DESTDIR}"
34593459
# Install libParser is necessary
@@ -3463,15 +3463,14 @@ for host in "${ALL_HOSTS[@]}"; do
34633463
else
34643464
# We have a toolchain so install to the toolchain
34653465
DYLIB_DIR="${host_install_destdir}${host_install_prefix}/lib/swift/${SWIFT_HOST_VARIANT}"
3466-
MODULE_DIR="${DYLIB_DIR}/${product}.swiftmodule"
3466+
MODULE_DIR="${DYLIB_DIR}/${product}.swiftmodule/${SWIFT_HOST_VARIANT_ARCH}"
34673467
fi
34683468
if [[ "${SKIP_SWIFTSYNTAX_SWIFTSIDE}" ]]; then
34693469
continue
34703470
fi
34713471
set_swiftsyntax_build_command
34723472
if [[ -z "${SKIP_INSTALL_SWIFTSYNTAX_MODULE}" ]] ; then
3473-
mkdir -p "${MODULE_DIR}"
3474-
call "${swiftsyntax_build_command[@]}" --dylib-dir="${DYLIB_DIR}" --swiftmodule-base-name "${MODULE_DIR}/${SWIFT_HOST_VARIANT_ARCH}" --install
3473+
call "${swiftsyntax_build_command[@]}" --dylib-dir="${DYLIB_DIR}" --swiftmodule-base-name "${MODULE_DIR}" --install
34753474
else
34763475
call "${swiftsyntax_build_command[@]}" --dylib-dir="${DYLIB_DIR}" --install
34773476
fi

0 commit comments

Comments
 (0)