Skip to content

Commit 8eeb38d

Browse files
committed
---
yaml --- r: 348774 b: refs/heads/master c: 8b8c88e h: refs/heads/master
1 parent 692aab8 commit 8eeb38d

File tree

164 files changed

+4948
-5809
lines changed

Some content is hidden

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

164 files changed

+4948
-5809
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: 414a4e2a1cd8c506ea84018d4af8d8d0c88413ff
2+
refs/heads/master: 8b8c88e258ab5c8b1977b34d7f83e3911a8c09dc
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/docs/WindowsBuild.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,13 @@ cmake -G "Visual Studio 2017" -A x64 -T "host=x64"^ ...
186186
md "S:\b\lldb"
187187
cd "S:\b\lldb"
188188
cmake -G Ninja^
189-
-DLLVM_DIR="S:/b/llvm/lib/cmake/llvm"^
190-
-DClang_DIR="S:/b/llvm/lib/cmake/clang"^
191-
-DSwift_DIR="S:/b/swift/lib/cmake/swift"^
192189
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
193190
-DLLDB_ALLOW_STATIC_BINDINGS=YES^
191+
-DLLDB_PATH_TO_CLANG_SOURCE="S:\clang"^
192+
-DLLDB_PATH_TO_SWIFT_SOURCE="S:\swift"^
193+
-DLLDB_PATH_TO_CLANG_BUILD="S:\b\llvm"^
194+
-DLLDB_PATH_TO_LLVM_BUILD="S:\b\llvm"^
195+
-DLLDB_PATH_TO_SWIFT_BUILD="S:\b\swift"^
194196
-DLLVM_ENABLE_ASSERTIONS=ON^
195197
-DPYTHON_HOME="%ProgramFiles(x86)%\Microsoft Visual Studio\Shared\Python37_64"^
196198
S:\lldb

trunk/include/swift/AST/DiagnosticConsumer.h

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,10 @@ enum class DiagnosticKind : uint8_t {
3838
Note
3939
};
4040

41-
/// Information about a diagnostic passed to DiagnosticConsumers.
41+
/// Extra information carried along with a diagnostic, which may or
42+
/// may not be of interest to a given diagnostic consumer.
4243
struct DiagnosticInfo {
4344
DiagID ID = DiagID(0);
44-
SourceLoc Loc;
45-
DiagnosticKind Kind;
46-
StringRef FormatString;
47-
ArrayRef<DiagnosticArgument> FormatArgs;
48-
SourceLoc BufferIndirectlyCausingDiagnostic;
49-
50-
/// DiagnosticInfo of notes which are children of this diagnostic, if any
51-
ArrayRef<DiagnosticInfo *> ChildDiagnosticInfo;
5245

5346
/// Represents a fix-it, a replacement of one range of text with another.
5447
class FixIt {
@@ -67,24 +60,6 @@ struct DiagnosticInfo {
6760

6861
/// Extra source ranges that are attached to the diagnostic.
6962
ArrayRef<FixIt> FixIts;
70-
71-
/// This is a note which has a parent error or warning
72-
bool IsChildNote = false;
73-
74-
DiagnosticInfo() {}
75-
76-
DiagnosticInfo(DiagID ID, SourceLoc Loc, DiagnosticKind Kind,
77-
StringRef FormatString,
78-
ArrayRef<DiagnosticArgument> FormatArgs,
79-
SourceLoc BufferIndirectlyCausingDiagnostic,
80-
ArrayRef<DiagnosticInfo *> ChildDiagnosticInfo,
81-
ArrayRef<CharSourceRange> Ranges, ArrayRef<FixIt> FixIts,
82-
bool IsChildNote)
83-
: ID(ID), Loc(Loc), Kind(Kind), FormatString(FormatString),
84-
FormatArgs(FormatArgs),
85-
BufferIndirectlyCausingDiagnostic(BufferIndirectlyCausingDiagnostic),
86-
ChildDiagnosticInfo(ChildDiagnosticInfo), Ranges(Ranges),
87-
FixIts(FixIts), IsChildNote(IsChildNote) {}
8863
};
8964

9065
/// Abstract interface for classes that present diagnostics to the user.

trunk/include/swift/AST/DiagnosticEngine.h

Lines changed: 2 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,7 @@ namespace swift {
337337
SmallVector<DiagnosticArgument, 3> Args;
338338
SmallVector<CharSourceRange, 2> Ranges;
339339
SmallVector<FixIt, 2> FixIts;
340-
std::vector<Diagnostic> ChildNotes;
341340
SourceLoc Loc;
342-
bool IsChildNote = false;
343341
const Decl *Decl = nullptr;
344342

345343
friend DiagnosticEngine;
@@ -364,13 +362,10 @@ namespace swift {
364362
ArrayRef<DiagnosticArgument> getArgs() const { return Args; }
365363
ArrayRef<CharSourceRange> getRanges() const { return Ranges; }
366364
ArrayRef<FixIt> getFixIts() const { return FixIts; }
367-
ArrayRef<Diagnostic> getChildNotes() const { return ChildNotes; }
368-
bool isChildNote() const { return IsChildNote; }
369365
SourceLoc getLoc() const { return Loc; }
370366
const class Decl *getDecl() const { return Decl; }
371367

372368
void setLoc(SourceLoc loc) { Loc = loc; }
373-
void setIsChildNote(bool isChildNote) { IsChildNote = isChildNote; }
374369
void setDecl(const class Decl *decl) { Decl = decl; }
375370

376371
/// Returns true if this object represents a particular diagnostic.
@@ -391,8 +386,6 @@ namespace swift {
391386
void addFixIt(FixIt &&F) {
392387
FixIts.push_back(std::move(F));
393388
}
394-
395-
void addChildNote(Diagnostic &&D);
396389
};
397390

398391
/// Describes an in-flight diagnostic, which is currently active
@@ -672,8 +665,7 @@ namespace swift {
672665

673666
friend class InFlightDiagnostic;
674667
friend class DiagnosticTransaction;
675-
friend class CompoundDiagnosticTransaction;
676-
668+
677669
public:
678670
explicit DiagnosticEngine(SourceManager &SourceMgr)
679671
: SourceMgr(SourceMgr), ActiveDiagnostic(),
@@ -886,15 +878,6 @@ namespace swift {
886878
return diagnose(decl, Diagnostic(id, std::move(args)...));
887879
}
888880

889-
/// Emit a parent diagnostic and attached notes.
890-
///
891-
/// \param parentDiag An InFlightDiagnostic representing the parent diag.
892-
///
893-
/// \param builder A closure which builds and emits notes to be attached to
894-
/// the parent diag.
895-
void diagnoseWithNotes(InFlightDiagnostic parentDiag,
896-
llvm::function_ref<void(void)> builder);
897-
898881
/// \returns true if diagnostic is marked with PointsToFirstBadToken
899882
/// option.
900883
bool isDiagnosticPointsToFirstBadToken(DiagID id) const;
@@ -922,10 +905,6 @@ namespace swift {
922905
/// Retrieve the active diagnostic.
923906
Diagnostic &getActiveDiagnostic() { return *ActiveDiagnostic; }
924907

925-
/// Generate DiagnosticInfo for a Diagnostic to be passed to consumers.
926-
Optional<DiagnosticInfo>
927-
diagnosticInfoForDiagnostic(const Diagnostic &diagnostic);
928-
929908
/// Send \c diag to all diagnostic consumers.
930909
void emitDiagnostic(const Diagnostic &diag);
931910

@@ -966,7 +945,6 @@ namespace swift {
966945
/// in LIFO order. An open transaction is implicitly committed upon
967946
/// destruction.
968947
class DiagnosticTransaction {
969-
protected:
970948
DiagnosticEngine &Engine;
971949

972950
/// How many tentative diagnostics there were when the transaction
@@ -990,6 +968,7 @@ namespace swift {
990968
Depth(Engine.TransactionCount),
991969
IsOpen(true)
992970
{
971+
assert(!Engine.ActiveDiagnostic);
993972
Engine.TransactionCount++;
994973
}
995974

@@ -1032,61 +1011,6 @@ namespace swift {
10321011
"transactions must be closed LIFO");
10331012
}
10341013
};
1035-
1036-
/// Represents a diagnostic transaction which constructs a compound diagnostic
1037-
/// from any diagnostics emitted inside. A compound diagnostic consists of a
1038-
/// parent error, warning, or remark followed by a variable number of child
1039-
/// notes. The semantics are otherwise the same as a regular
1040-
/// DiagnosticTransaction.
1041-
class CompoundDiagnosticTransaction : public DiagnosticTransaction {
1042-
public:
1043-
explicit CompoundDiagnosticTransaction(DiagnosticEngine &engine)
1044-
: DiagnosticTransaction(engine) {}
1045-
1046-
~CompoundDiagnosticTransaction() {
1047-
if (IsOpen) {
1048-
commit();
1049-
}
1050-
1051-
if (Depth == 0) {
1052-
Engine.TransactionStrings.clear();
1053-
Engine.TransactionAllocator.Reset();
1054-
}
1055-
}
1056-
1057-
void commit() {
1058-
assert(PrevDiagnostics < Engine.TentativeDiagnostics.size() &&
1059-
"CompoundDiagnosticTransaction must contain at least one diag");
1060-
1061-
// The first diagnostic is assumed to be the parent. If this is not an
1062-
// error or warning, we'll assert later when trying to add children.
1063-
Diagnostic &parent = Engine.TentativeDiagnostics[PrevDiagnostics];
1064-
1065-
// Associate the children with the parent.
1066-
for (auto diag =
1067-
Engine.TentativeDiagnostics.begin() + PrevDiagnostics + 1;
1068-
diag != Engine.TentativeDiagnostics.end(); ++diag) {
1069-
diag->setIsChildNote(true);
1070-
parent.addChildNote(std::move(*diag));
1071-
}
1072-
1073-
// Erase the children, they'll be emitted alongside their parent.
1074-
Engine.TentativeDiagnostics.erase(Engine.TentativeDiagnostics.begin() +
1075-
PrevDiagnostics + 1,
1076-
Engine.TentativeDiagnostics.end());
1077-
1078-
DiagnosticTransaction::commit();
1079-
}
1080-
};
1081-
1082-
inline void
1083-
DiagnosticEngine::diagnoseWithNotes(InFlightDiagnostic parentDiag,
1084-
llvm::function_ref<void(void)> builder) {
1085-
CompoundDiagnosticTransaction transaction(*this);
1086-
parentDiag.flush();
1087-
builder();
1088-
}
1089-
10901014
} // end namespace swift
10911015

10921016
#endif

trunk/include/swift/AST/Identifier.h

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,8 @@ class Identifier {
5656

5757
const char *Pointer;
5858

59-
public:
60-
enum : size_t {
61-
NumLowBitsAvailable = 2,
62-
RequiredAlignment = 1 << NumLowBitsAvailable,
63-
SpareBitMask = ((intptr_t)1 << NumLowBitsAvailable) - 1
64-
};
65-
66-
private:
6759
/// Constructor, only accessible by ASTContext, which handles the uniquing.
68-
explicit Identifier(const char *Ptr) : Pointer(Ptr) {
69-
assert(((uintptr_t)Ptr & SpareBitMask) == 0
70-
&& "Identifier pointer does not use any spare bits");
71-
}
72-
73-
/// A type with the alignment expected of a valid \c Identifier::Pointer .
74-
struct alignas(uint32_t) Aligner {};
75-
76-
static_assert(alignof(Aligner) >= RequiredAlignment,
77-
"Identifier table will provide enough spare bits");
78-
60+
explicit Identifier(const char *Ptr) : Pointer(Ptr) {}
7961
public:
8062
explicit Identifier() : Pointer(nullptr) {}
8163

@@ -171,15 +153,12 @@ class Identifier {
171153
bool operator<(Identifier RHS) const { return Pointer < RHS.Pointer; }
172154

173155
static Identifier getEmptyKey() {
174-
uintptr_t Val = static_cast<uintptr_t>(-1);
175-
Val <<= NumLowBitsAvailable;
176-
return Identifier((const char*)Val);
156+
return Identifier((const char*)
157+
llvm::DenseMapInfo<const void*>::getEmptyKey());
177158
}
178-
179159
static Identifier getTombstoneKey() {
180-
uintptr_t Val = static_cast<uintptr_t>(-2);
181-
Val <<= NumLowBitsAvailable;
182-
return Identifier((const char*)Val);
160+
return Identifier((const char*)
161+
llvm::DenseMapInfo<const void*>::getTombstoneKey());
183162
}
184163

185164
private:
@@ -223,7 +202,7 @@ namespace llvm {
223202
static inline swift::Identifier getFromVoidPointer(void *P) {
224203
return swift::Identifier::getFromOpaquePointer(P);
225204
}
226-
enum { NumLowBitsAvailable = swift::Identifier::NumLowBitsAvailable };
205+
enum { NumLowBitsAvailable = 2 };
227206
};
228207

229208
} // end namespace llvm
@@ -242,15 +221,15 @@ class DeclBaseName {
242221
};
243222

244223
private:
245-
/// In a special DeclName representing a subscript, this opaque pointer
224+
/// In a special DeclName represenenting a subscript, this opaque pointer
246225
/// is used as the data of the base name identifier.
247226
/// This is an implementation detail that should never leak outside of
248227
/// DeclName.
249-
static const Identifier::Aligner SubscriptIdentifierData;
228+
static void *SubscriptIdentifierData;
250229
/// As above, for special constructor DeclNames.
251-
static const Identifier::Aligner ConstructorIdentifierData;
230+
static void *ConstructorIdentifierData;
252231
/// As above, for special destructor DeclNames.
253-
static const Identifier::Aligner DestructorIdentifierData;
232+
static void *DestructorIdentifierData;
254233

255234
Identifier Ident;
256235

@@ -260,23 +239,23 @@ class DeclBaseName {
260239
DeclBaseName(Identifier I) : Ident(I) {}
261240

262241
static DeclBaseName createSubscript() {
263-
return DeclBaseName(Identifier((const char *)&SubscriptIdentifierData));
242+
return DeclBaseName(Identifier((const char *)SubscriptIdentifierData));
264243
}
265244

266245
static DeclBaseName createConstructor() {
267-
return DeclBaseName(Identifier((const char *)&ConstructorIdentifierData));
246+
return DeclBaseName(Identifier((const char *)ConstructorIdentifierData));
268247
}
269248

270249
static DeclBaseName createDestructor() {
271-
return DeclBaseName(Identifier((const char *)&DestructorIdentifierData));
250+
return DeclBaseName(Identifier((const char *)DestructorIdentifierData));
272251
}
273252

274253
Kind getKind() const {
275-
if (Ident.get() == (const char *)&SubscriptIdentifierData) {
254+
if (Ident.get() == SubscriptIdentifierData) {
276255
return Kind::Subscript;
277-
} else if (Ident.get() == (const char *)&ConstructorIdentifierData) {
256+
} else if (Ident.get() == ConstructorIdentifierData) {
278257
return Kind::Constructor;
279-
} else if (Ident.get() == (const char *)&DestructorIdentifierData) {
258+
} else if (Ident.get() == DestructorIdentifierData) {
280259
return Kind::Destructor;
281260
} else {
282261
return Kind::Normal;
@@ -741,7 +720,7 @@ namespace llvm {
741720
static inline swift::DeclName getFromVoidPointer(void *ptr) {
742721
return swift::DeclName::getFromOpaqueValue(ptr);
743722
}
744-
enum { NumLowBitsAvailable = PointerLikeTypeTraits<swift::DeclBaseName>::NumLowBitsAvailable - 2 };
723+
enum { NumLowBitsAvailable = 0 };
745724
};
746725

747726
// DeclNames hash just like pointers.

trunk/include/swift/Basic/STLExtras.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ class TransformRange {
488488
Operation Op;
489489

490490
public:
491-
using iterator = TransformIterator<typename Range::iterator, Operation>;
491+
using iterator = TransformIterator<decltype(Rng.begin()), Operation>;
492492

493493
TransformRange(Range range, Operation op)
494494
: Rng(range), Op(op) { }
@@ -497,6 +497,20 @@ class TransformRange {
497497
iterator end() const { return iterator(Rng.end(), Op); }
498498
bool empty() const { return begin() == end(); }
499499

500+
// The dummy template parameter keeps 'size()' from being eagerly
501+
// instantiated.
502+
template <typename Dummy = Range>
503+
typename function_traits<decltype(&Dummy::size)>::result_type
504+
size() const {
505+
return Rng.size();
506+
}
507+
508+
template <typename Index>
509+
typename function_traits<Operation>::result_type
510+
operator[](Index index) const {
511+
return Op(Rng[index]);
512+
}
513+
500514
typename std::iterator_traits<iterator>::value_type front() const {
501515
assert(!empty() && "Front of empty range");
502516
return *begin();

0 commit comments

Comments
 (0)