Skip to content

Commit 350f79e

Browse files
committed
---
yaml --- r: 326555 b: refs/heads/tensorflow c: c08a627 h: refs/heads/master i: 326553: 6c909f1 326551: ec44276
1 parent db71f01 commit 350f79e

Some content is hidden

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

64 files changed

+720
-1877
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a: 22f738a831d43aff2b9c9773bcb65
816816
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-05-08-a: 7d98cc16689baba5c8a3b90a9329bdcc1a12b4e9
817817
refs/heads/cherr42: a566ad54b073c2c56ac0a705d0a5bed9743135a5
818818
"refs/heads/codable_test_comment_fix": fc8f6824f7f347e1e8db55bff62db385c5728b5a
819-
refs/heads/tensorflow: 7697611c1503499646445061faaabc5c2b018ff1
819+
refs/heads/tensorflow: c08a62764a95844883cd44f7d457d6bd1c253bb4
820820
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-11-a: 8126fd7a652e2f70ad6d76505239e34fb2ef3e1a
821821
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-12-a: b3fd3dd84df6717f2e2e9df58c6d7e99fed57086
822822
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-13-a: 71135119579039dc321c5f65d870050fe36efda2

branches/tensorflow/include/swift/AST/ASTScope.h

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,8 @@ class ASTScopeImpl {
177177
void addChild(ASTScopeImpl *child, ASTContext &);
178178
std::vector<ASTScopeImpl *> rescueYoungestChildren(unsigned count);
179179

180-
/// When reexpanding, do we always create a new body?
181-
virtual NullablePtr<ASTScopeImpl> getParentOfRescuedScopes();
182-
std::vector<ASTScopeImpl *> rescueScopesToReuse();
183-
void addReusedScopes(ArrayRef<ASTScopeImpl *>);
180+
virtual std::vector<ASTScopeImpl *> rescueScopesToReuse();
181+
virtual void addReusedScopes(ArrayRef<ASTScopeImpl *>);
184182

185183
private:
186184
void removeChildren();
@@ -203,8 +201,7 @@ class ASTScopeImpl {
203201
/// InterpolatedStringLiteralExprs and EditorPlaceHolders respond to
204202
/// getSourceRange with the starting point. But we might be asked to lookup an
205203
/// identifer within one of them. So, find the real source range of them here.
206-
///
207-
/// FIXME: Alter how these are parsed so getSourceRange is enough.
204+
/// /// FIXME: Alter how these are parsed so getSourceRange is enough.
208205
SourceRange getEffectiveSourceRange(ASTNode) const;
209206

210207
void cacheSourceRangeOfMeAndDescendants(bool omitAssertions = false) const;
@@ -306,12 +303,6 @@ class ASTScopeImpl {
306303
virtual void beCurrent();
307304
virtual bool isCurrent() const;
308305

309-
/// Some scopes can be expanded lazily.
310-
/// Such scopes must: not change their source ranges after expansion, and
311-
/// their expansion must return an insertion point outside themselves.
312-
virtual NullablePtr<ASTScopeImpl> insertionPointForDeferredExpansion();
313-
virtual SourceRange sourceRangeForDeferredExpansion() const;
314-
315306
public:
316307
// Some nodes (VarDecls and Accessors) are created directly from
317308
// pattern scope code and should neither be deferred nor should
@@ -557,10 +548,6 @@ class Portion {
557548

558549
virtual void beCurrent(IterableTypeScope *) const;
559550
virtual bool isCurrent(const IterableTypeScope *) const;
560-
virtual NullablePtr<ASTScopeImpl>
561-
insertionPointForDeferredExpansion(IterableTypeScope *) const;
562-
virtual SourceRange
563-
sourceRangeForDeferredExpansion(const IterableTypeScope *) const;
564551
};
565552

566553
// For the whole Decl scope of a GenericType or an Extension
@@ -636,10 +623,6 @@ class IterableTypeBodyPortion final
636623

637624
void beCurrent(IterableTypeScope *) const override;
638625
bool isCurrent(const IterableTypeScope *) const override;
639-
NullablePtr<ASTScopeImpl>
640-
insertionPointForDeferredExpansion(IterableTypeScope *) const override;
641-
SourceRange
642-
sourceRangeForDeferredExpansion(const IterableTypeScope *) const override;
643626
};
644627

645628
/// GenericType or Extension scope
@@ -719,6 +702,7 @@ class IterableTypeScope : public GenericTypeScope {
719702
/// Because of \c parseDelayedDecl members can get added after the tree is
720703
/// constructed, and they can be out of order. Detect this happening by
721704
/// remembering the member count.
705+
/// TODO: unify with \c numberOfDeclsAlreadySeen
722706
unsigned memberCount = 0;
723707

724708
public:
@@ -737,8 +721,6 @@ class IterableTypeScope : public GenericTypeScope {
737721
public:
738722
void makeBodyCurrent();
739723
bool isBodyCurrent() const;
740-
NullablePtr<ASTScopeImpl> insertionPointForDeferredExpansion() override;
741-
SourceRange sourceRangeForDeferredExpansion() const override;
742724
};
743725

744726
class NominalTypeScope final : public IterableTypeScope {
@@ -976,7 +958,8 @@ class AbstractFunctionBodyScope : public ASTScopeImpl {
976958
Decl *getDecl() const { return decl; }
977959
static bool isAMethod(const AbstractFunctionDecl *);
978960

979-
NullablePtr<ASTScopeImpl> getParentOfRescuedScopes() override;
961+
std::vector<ASTScopeImpl *> rescueScopesToReuse() override;
962+
void addReusedScopes(ArrayRef<ASTScopeImpl *>) override;
980963

981964
protected:
982965
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
@@ -1139,6 +1122,7 @@ class PatternEntryDeclScope final : public AbstractPatternEntryScope {
11391122
SourceRange
11401123
getChildlessSourceRange(bool omitAssertions = false) const override;
11411124

1125+
static bool isHandledSpecially(const ASTNode n);
11421126
NullablePtr<const void> getReferrent() const override;
11431127

11441128
protected:
@@ -1388,7 +1372,8 @@ class TopLevelCodeScope final : public ASTScopeImpl {
13881372
Decl *getDecl() const { return decl; }
13891373
NullablePtr<const void> getReferrent() const override;
13901374

1391-
NullablePtr<ASTScopeImpl> getParentOfRescuedScopes() override;
1375+
std::vector<ASTScopeImpl *> rescueScopesToReuse() override;
1376+
void addReusedScopes(ArrayRef<ASTScopeImpl *>) override;
13921377
};
13931378

13941379
/// The \c _@specialize attribute.

branches/tensorflow/include/swift/AST/ClangModuleLoader.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -71,32 +71,6 @@ class ClangModuleLoader : public ModuleLoader {
7171
virtual bool
7272
isInOverlayModuleForImportedModule(const DeclContext *overlayDC,
7373
const DeclContext *importedDC) = 0;
74-
75-
/// Look for declarations associated with the given name.
76-
///
77-
/// \param name The name we're searching for.
78-
virtual void lookupValue(DeclName name, VisibleDeclConsumer &consumer) {}
79-
80-
/// Look up a type declaration by its Clang name.
81-
///
82-
/// Note that this method does no filtering. If it finds the type in a loaded
83-
/// module, it returns it. This is intended for use in reflection / debugging
84-
/// contexts where access is not a problem.
85-
virtual void lookupTypeDecl(StringRef clangName, ClangTypeKind kind,
86-
llvm::function_ref<void(TypeDecl *)> receiver) {}
87-
88-
/// Look up type a declaration synthesized by the Clang importer itself, using
89-
/// a "related entity kind" to determine which type it should be. For example,
90-
/// this can be used to find the synthesized error struct for an
91-
/// NS_ERROR_ENUM.
92-
///
93-
/// Note that this method does no filtering. If it finds the type in a loaded
94-
/// module, it returns it. This is intended for use in reflection / debugging
95-
/// contexts where access is not a problem.
96-
virtual void
97-
lookupRelatedEntity(StringRef clangName, ClangTypeKind kind,
98-
StringRef relatedEntityKind,
99-
llvm::function_ref<void(TypeDecl *)> receiver) {}
10074
};
10175

10276
} // namespace swift

branches/tensorflow/include/swift/AST/Decl.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,17 +1523,6 @@ class GenericContext : private _GenericContext, public DeclContext {
15231523

15241524
/// Determine whether this context has generic parameters
15251525
/// of its own.
1526-
///
1527-
/// \code
1528-
/// class C<T> {
1529-
/// func f1() {} // isGeneric == false
1530-
/// func f2<T>() {} // isGeneric == true
1531-
/// }
1532-
///
1533-
/// protocol P { // isGeneric == true due to implicit Self param
1534-
/// func p() // isGeneric == false
1535-
/// }
1536-
/// \endcode
15371526
bool isGeneric() const { return GenericParams != nullptr; }
15381527

15391528
/// Retrieve the trailing where clause for this extension, if any.

branches/tensorflow/include/swift/AST/Expr.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5321,33 +5321,6 @@ class KeyPathDotExpr : public Expr {
53215321
}
53225322
};
53235323

5324-
/// Expression node that effects a "one-way" constraint in
5325-
/// the constraint system, allowing type information to flow from the
5326-
/// subexpression outward but not the other way.
5327-
///
5328-
/// One-way expressions are generally implicit and synthetic, introduced by
5329-
/// the type checker. However, there is a built-in expression of the
5330-
/// form \c Builtin.one_way(x) that forms a one-way constraint coming out
5331-
/// of expression `x` that can be used for testing purposes.
5332-
class OneWayExpr : public Expr {
5333-
Expr *SubExpr;
5334-
5335-
public:
5336-
/// Construct an implicit one-way expression from the given subexpression.
5337-
OneWayExpr(Expr *subExpr)
5338-
: Expr(ExprKind::OneWay, /*isImplicit=*/true), SubExpr(subExpr) { }
5339-
5340-
SourceLoc getLoc() const { return SubExpr->getLoc(); }
5341-
SourceRange getSourceRange() const { return SubExpr->getSourceRange(); }
5342-
5343-
Expr *getSubExpr() const { return SubExpr; }
5344-
void setSubExpr(Expr *subExpr) { SubExpr = subExpr; }
5345-
5346-
static bool classof(const Expr *E) {
5347-
return E->getKind() == ExprKind::OneWay;
5348-
}
5349-
};
5350-
53515324
inline bool Expr::isInfixOperator() const {
53525325
return isa<BinaryExpr>(this) || isa<IfExpr>(this) ||
53535326
isa<AssignExpr>(this) || isa<ExplicitCastExpr>(this);

branches/tensorflow/include/swift/AST/ExprNodes.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ EXPR(EditorPlaceholder, Expr)
191191
EXPR(ObjCSelector, Expr)
192192
EXPR(KeyPath, Expr)
193193
UNCHECKED_EXPR(KeyPathDot, Expr)
194-
UNCHECKED_EXPR(OneWay, Expr)
195194
EXPR(Tap, Expr)
196195
LAST_EXPR(Tap)
197196

branches/tensorflow/include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ namespace swift {
115115
/// Only used by lldb-moduleimport-test.
116116
bool EnableMemoryBufferImporter = false;
117117

118-
/// Enable the DWARFImporter. Only used by lldb-moduleimport-test.
119-
bool EnableDWARFImporter = false;
120-
121118
/// Allows using identifiers with a leading dollar.
122119
bool EnableDollarIdentifiers = false;
123120

@@ -215,9 +212,6 @@ namespace swift {
215212
/// before termination of the shrink phrase of the constraint solver.
216213
unsigned SolverShrinkUnsolvedThreshold = 10;
217214

218-
/// Enable one-way constraints in function builders.
219-
bool FunctionBuilderOneWayConstraints = false;
220-
221215
/// Disable the shrink phase of the expression type checker.
222216
bool SolverDisableShrink = false;
223217

@@ -271,9 +265,6 @@ namespace swift {
271265
/// whether it is. The warning is useful for testing.
272266
bool WarnIfASTScopeLookup = false;
273267

274-
/// Build the ASTScope tree lazily
275-
bool LazyASTScopes = false;
276-
277268
/// Whether to use the import as member inference system
278269
///
279270
/// When importing a global, try to infer whether we can import it as a

branches/tensorflow/include/swift/ClangImporter/ClangImporter.h

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,28 @@ class TypeDecl;
6060
class VisibleDeclConsumer;
6161
enum class SelectorSplitKind;
6262

63+
/// This interface is implemented by LLDB to serve as a fallback when Clang
64+
/// modules can't be imported from source in the debugger.
65+
///
66+
/// During compile time, ClangImporter-imported Clang modules are compiled with
67+
/// -gmodules, which emits a DWARF rendition of all types defined in the module
68+
/// into the .pcm file. On Darwin, these types can be collected by
69+
/// dsymutil. This delegate allows DWARFImporter to ask LLDB to look up a Clang
70+
/// type by name, synthesize a Clang AST from it. DWARFImporter then hands this
71+
/// Clang AST to ClangImporter to import the type into Swift.
72+
class DWARFImporterDelegate {
73+
public:
74+
virtual ~DWARFImporterDelegate() {}
75+
/// Perform a qualified lookup of a Clang type with this name.
76+
/// \param kind Only return results with this type kind.
77+
virtual void lookupValue(StringRef name, llvm::Optional<ClangTypeKind> kind,
78+
SmallVectorImpl<clang::Decl *> &results) {}
79+
};
80+
6381
/// Class that imports Clang modules into Swift, mapping directly
6482
/// from Clang ASTs over to Swift ASTs.
6583
class ClangImporter final : public ClangModuleLoader {
6684
friend class ClangModuleUnit;
67-
friend class DWARFImporter;
6885

6986
public:
7087
class Implementation;
@@ -73,8 +90,11 @@ class ClangImporter final : public ClangModuleLoader {
7390
Implementation &Impl;
7491

7592
ClangImporter(ASTContext &ctx, const ClangImporterOptions &clangImporterOpts,
76-
DependencyTracker *tracker);
93+
DependencyTracker *tracker,
94+
std::unique_ptr<DWARFImporterDelegate> dwarfImporterDelegate);
7795

96+
ModuleDecl *loadModuleClang(SourceLoc importLoc,
97+
ArrayRef<std::pair<Identifier, SourceLoc>> path);
7898
public:
7999
/// Create a new Clang importer that can import a suitable Clang
80100
/// module into the given ASTContext.
@@ -89,13 +109,15 @@ class ClangImporter final : public ClangModuleLoader {
89109
///
90110
/// \param tracker The object tracking files this compilation depends on.
91111
///
112+
/// \param dwarfImporterDelegate A helper object that can synthesize
113+
/// Clang Decls from debug info. Used by LLDB.
114+
///
92115
/// \returns a new Clang module importer, or null (with a diagnostic) if
93116
/// an error occurred.
94117
static std::unique_ptr<ClangImporter>
95-
create(ASTContext &ctx,
96-
const ClangImporterOptions &importerOpts,
97-
std::string swiftPCHHash = "",
98-
DependencyTracker *tracker = nullptr);
118+
create(ASTContext &ctx, const ClangImporterOptions &importerOpts,
119+
std::string swiftPCHHash = "", DependencyTracker *tracker = nullptr,
120+
std::unique_ptr<DWARFImporterDelegate> dwarfImporterDelegate = {});
99121

100122
ClangImporter(const ClangImporter &) = delete;
101123
ClangImporter(ClangImporter &&) = delete;
@@ -150,15 +172,15 @@ class ClangImporter final : public ClangModuleLoader {
150172
/// Look for declarations associated with the given name.
151173
///
152174
/// \param name The name we're searching for.
153-
void lookupValue(DeclName name, VisibleDeclConsumer &consumer) override;
175+
void lookupValue(DeclName name, VisibleDeclConsumer &consumer);
154176

155177
/// Look up a type declaration by its Clang name.
156178
///
157179
/// Note that this method does no filtering. If it finds the type in a loaded
158180
/// module, it returns it. This is intended for use in reflection / debugging
159181
/// contexts where access is not a problem.
160182
void lookupTypeDecl(StringRef clangName, ClangTypeKind kind,
161-
llvm::function_ref<void(TypeDecl *)> receiver) override;
183+
llvm::function_ref<void(TypeDecl *)> receiver);
162184

163185
/// Look up type a declaration synthesized by the Clang importer itself, using
164186
/// a "related entity kind" to determine which type it should be. For example,
@@ -171,7 +193,7 @@ class ClangImporter final : public ClangModuleLoader {
171193
void
172194
lookupRelatedEntity(StringRef clangName, ClangTypeKind kind,
173195
StringRef relatedEntityKind,
174-
llvm::function_ref<void(TypeDecl *)> receiver) override;
196+
llvm::function_ref<void(TypeDecl *)> receiver);
175197

176198
/// Look for textually included declarations from the bridging header.
177199
///

0 commit comments

Comments
 (0)