Skip to content

Commit f809a87

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-rebranch
2 parents 16839ab + 02b5e56 commit f809a87

Some content is hidden

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

47 files changed

+3554
-757
lines changed

include/swift/AST/ASTTypeIDs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include "swift/Basic/TypeID.h"
2222
namespace swift {
2323

24+
class AbstractFunctionDecl;
25+
class BraceStmt;
2426
class CustomAttr;
2527
class Decl;
2628
class GenericParamList;

include/swift/AST/DiagnosticEngine.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@
1818
#ifndef SWIFT_BASIC_DIAGNOSTICENGINE_H
1919
#define SWIFT_BASIC_DIAGNOSTICENGINE_H
2020

21-
#include "swift/AST/Attr.h"
2221
#include "swift/AST/TypeLoc.h"
2322
#include "swift/AST/DeclNameLoc.h"
2423
#include "swift/AST/DiagnosticConsumer.h"
2524
#include "llvm/ADT/StringMap.h"
2625
#include "llvm/Support/Allocator.h"
26+
#include "llvm/Support/VersionTuple.h"
2727

2828
namespace swift {
2929
class Decl;
30+
class DeclAttribute;
3031
class DiagnosticEngine;
3132
class SourceManager;
3233
class ValueDecl;

include/swift/AST/Expr.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919

2020
#include "swift/AST/CaptureInfo.h"
2121
#include "swift/AST/ConcreteDeclRef.h"
22+
#include "swift/AST/DeclContext.h"
2223
#include "swift/AST/DeclNameLoc.h"
2324
#include "swift/AST/FunctionRefKind.h"
2425
#include "swift/AST/ProtocolConformanceRef.h"
2526
#include "swift/AST/TrailingCallArguments.h"
2627
#include "swift/AST/TypeAlignments.h"
2728
#include "swift/AST/TypeLoc.h"
28-
#include "swift/AST/TypeRepr.h"
2929
#include "swift/AST/Availability.h"
3030
#include "swift/Basic/InlineBitfield.h"
3131
#include "llvm/Support/TrailingObjects.h"
@@ -40,7 +40,9 @@ namespace swift {
4040
class ArchetypeType;
4141
class ASTContext;
4242
class AvailabilitySpec;
43+
class IdentTypeRepr;
4344
class Type;
45+
class TypeRepr;
4446
class ValueDecl;
4547
class Decl;
4648
class DeclRefExpr;

include/swift/Parse/ASTGen.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
#include "llvm/ADT/DenseMap.h"
2222

2323
namespace swift {
24+
class ComponentIdentTypeRepr;
25+
class TupleTypeRepr;
26+
2427
/// Generates AST nodes from Syntax nodes.
2528
class Parser;
2629
class ASTGen {

include/swift/Reflection/Records.h

Lines changed: 10 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ class FieldRecordFlags {
7070

7171
class FieldRecord {
7272
const FieldRecordFlags Flags;
73+
74+
public:
7375
const RelativeDirectPointer<const char> MangledTypeName;
7476
const RelativeDirectPointer<const char> FieldName;
7577

76-
public:
7778
FieldRecord() = delete;
7879

7980
bool hasMangledTypeName() const {
@@ -84,11 +85,8 @@ class FieldRecord {
8485
return Demangle::makeSymbolicMangledNameStringRef(MangledTypeName.get());
8586
}
8687

87-
StringRef getFieldName(uintptr_t Low, uintptr_t High) const {
88-
uintptr_t nameAddr = (uintptr_t)FieldName.get();
89-
if (nameAddr < Low || nameAddr > High)
90-
return "";
91-
return (const char *)nameAddr;
88+
StringRef getFieldName() const {
89+
return FieldName.get();
9290
}
9391

9492
bool isIndirectCase() const {
@@ -162,10 +160,10 @@ class FieldDescriptor {
162160
return reinterpret_cast<const FieldRecord *>(this + 1);
163161
}
164162

163+
public:
165164
const RelativeDirectPointer<const char> MangledTypeName;
166165
const RelativeDirectPointer<const char> Superclass;
167166

168-
public:
169167
FieldDescriptor() = delete;
170168

171169
const FieldDescriptorKind Kind;
@@ -227,46 +225,13 @@ class FieldDescriptor {
227225
}
228226
};
229227

230-
class FieldDescriptorIterator
231-
: public std::iterator<std::forward_iterator_tag, FieldDescriptor> {
232-
public:
233-
const void *Cur;
234-
const void * const End;
235-
FieldDescriptorIterator(const void *Cur, const void * const End)
236-
: Cur(Cur), End(End) {}
237-
238-
const FieldDescriptor &operator*() const {
239-
return *reinterpret_cast<const FieldDescriptor *>(Cur);
240-
}
241-
242-
const FieldDescriptor *operator->() const {
243-
return reinterpret_cast<const FieldDescriptor *>(Cur);
244-
}
245-
246-
FieldDescriptorIterator &operator++() {
247-
const auto &FR = this->operator*();
248-
const void *Next = reinterpret_cast<const char *>(Cur)
249-
+ sizeof(FieldDescriptor) + FR.NumFields * FR.FieldRecordSize;
250-
Cur = Next;
251-
return *this;
252-
}
253-
254-
bool operator==(FieldDescriptorIterator const &other) const {
255-
return Cur == other.Cur && End == other.End;
256-
}
257-
258-
bool operator!=(FieldDescriptorIterator const &other) const {
259-
return !(*this == other);
260-
}
261-
};
262-
263228
// Associated type records describe the mapping from an associated
264229
// type to the type witness of a conformance.
265230
class AssociatedTypeRecord {
231+
public:
266232
const RelativeDirectPointer<const char> Name;
267233
const RelativeDirectPointer<const char> SubstitutedTypeName;
268234

269-
public:
270235
StringRef getName() const {
271236
return Name.get();
272237
}
@@ -322,10 +287,9 @@ struct AssociatedTypeRecordIterator {
322287
// An associated type descriptor contains a collection of associated
323288
// type records for a conformance.
324289
struct AssociatedTypeDescriptor {
325-
private:
290+
public:
326291
const RelativeDirectPointer<const char> ConformingTypeName;
327292
const RelativeDirectPointer<const char> ProtocolTypeName;
328-
public:
329293

330294
uint32_t NumAssociatedTypes;
331295
uint32_t AssociatedTypeRecordSize;
@@ -357,46 +321,12 @@ struct AssociatedTypeDescriptor {
357321
}
358322
};
359323

360-
class AssociatedTypeIterator
361-
: public std::iterator<std::forward_iterator_tag, AssociatedTypeDescriptor> {
362-
public:
363-
const void *Cur;
364-
const void * const End;
365-
AssociatedTypeIterator(const void *Cur, const void * const End)
366-
: Cur(Cur), End(End) {}
367-
368-
const AssociatedTypeDescriptor &operator*() const {
369-
return *reinterpret_cast<const AssociatedTypeDescriptor *>(Cur);
370-
}
371-
372-
const AssociatedTypeDescriptor *operator->() const {
373-
return reinterpret_cast<const AssociatedTypeDescriptor *>(Cur);
374-
}
375-
376-
AssociatedTypeIterator &operator++() {
377-
const auto &ATR = this->operator*();
378-
size_t Size = sizeof(AssociatedTypeDescriptor) +
379-
ATR.NumAssociatedTypes * ATR.AssociatedTypeRecordSize;
380-
const void *Next = reinterpret_cast<const char *>(Cur) + Size;
381-
Cur = Next;
382-
return *this;
383-
}
384-
385-
bool operator==(AssociatedTypeIterator const &other) const {
386-
return Cur == other.Cur && End == other.End;
387-
}
388-
389-
bool operator!=(AssociatedTypeIterator const &other) const {
390-
return !(*this == other);
391-
}
392-
};
393-
394324
// Builtin type records describe basic layout information about
395325
// any builtin types referenced from the other sections.
396326
class BuiltinTypeDescriptor {
327+
public:
397328
const RelativeDirectPointer<const char> TypeName;
398329

399-
public:
400330
uint32_t Size;
401331

402332
// - Least significant 16 bits are the alignment.
@@ -424,42 +354,10 @@ class BuiltinTypeDescriptor {
424354
}
425355
};
426356

427-
class BuiltinTypeDescriptorIterator
428-
: public std::iterator<std::forward_iterator_tag, BuiltinTypeDescriptor> {
429-
public:
430-
const void *Cur;
431-
const void * const End;
432-
BuiltinTypeDescriptorIterator(const void *Cur, const void * const End)
433-
: Cur(Cur), End(End) {}
434-
435-
const BuiltinTypeDescriptor &operator*() const {
436-
return *reinterpret_cast<const BuiltinTypeDescriptor *>(Cur);
437-
}
438-
439-
const BuiltinTypeDescriptor *operator->() const {
440-
return reinterpret_cast<const BuiltinTypeDescriptor *>(Cur);;
441-
}
442-
443-
BuiltinTypeDescriptorIterator &operator++() {
444-
const void *Next = reinterpret_cast<const char *>(Cur)
445-
+ sizeof(BuiltinTypeDescriptor);
446-
Cur = Next;
447-
return *this;
448-
}
449-
450-
bool operator==(BuiltinTypeDescriptorIterator const &other) const {
451-
return Cur == other.Cur && End == other.End;
452-
}
453-
454-
bool operator!=(BuiltinTypeDescriptorIterator const &other) const {
455-
return !(*this == other);
456-
}
457-
};
458-
459357
class CaptureTypeRecord {
358+
public:
460359
const RelativeDirectPointer<const char> MangledTypeName;
461360

462-
public:
463361
CaptureTypeRecord() = delete;
464362

465363
bool hasMangledTypeName() const {
@@ -502,10 +400,10 @@ struct CaptureTypeRecordIterator {
502400
};
503401

504402
class MetadataSourceRecord {
403+
public:
505404
const RelativeDirectPointer<const char> MangledTypeName;
506405
const RelativeDirectPointer<const char> MangledMetadataSource;
507406

508-
public:
509407
MetadataSourceRecord() = delete;
510408

511409
bool hasMangledTypeName() const {
@@ -608,41 +506,6 @@ class CaptureDescriptor {
608506
}
609507
};
610508

611-
class CaptureDescriptorIterator
612-
: public std::iterator<std::forward_iterator_tag, CaptureDescriptor> {
613-
public:
614-
const void *Cur;
615-
const void * const End;
616-
CaptureDescriptorIterator(const void *Cur, const void * const End)
617-
: Cur(Cur), End(End) {}
618-
619-
const CaptureDescriptor &operator*() const {
620-
return *reinterpret_cast<const CaptureDescriptor *>(Cur);
621-
}
622-
623-
const CaptureDescriptor *operator->() const {
624-
return reinterpret_cast<const CaptureDescriptor *>(Cur);
625-
}
626-
627-
CaptureDescriptorIterator &operator++() {
628-
const auto &CR = this->operator*();
629-
const void *Next = reinterpret_cast<const char *>(Cur)
630-
+ sizeof(CaptureDescriptor)
631-
+ CR.NumCaptureTypes * sizeof(CaptureTypeRecord)
632-
+ CR.NumMetadataSources * sizeof(MetadataSourceRecord);
633-
Cur = Next;
634-
return *this;
635-
}
636-
637-
bool operator==(CaptureDescriptorIterator const &other) const {
638-
return Cur == other.Cur && End == other.End;
639-
}
640-
641-
bool operator!=(CaptureDescriptorIterator const &other) const {
642-
return !(*this == other);
643-
}
644-
};
645-
646509
} // end namespace reflection
647510
} // end namespace swift
648511

0 commit comments

Comments
 (0)