Skip to content

Commit 09a5670

Browse files
committed
---
yaml --- r: 341919 b: refs/heads/rxwei-patch-1 c: fc827e6 h: refs/heads/master i: 341917: 60151c2 341915: 08e4f2d 341911: 0ae51d1 341903: d6f635e 341887: 9491508
1 parent 26a8b39 commit 09a5670

Some content is hidden

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

45 files changed

+1073
-1949
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: a98bfd69e0a258f3101c649088390a3b774ca9ef
1018+
refs/heads/rxwei-patch-1: fc827e63be0d05271a4bacc88f3b223c1142e0e6
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/include/swift/ClangImporter/ClangImporterOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ class ClangImporterOptions {
100100
/// When set, don't enforce warnings with -Werror.
101101
bool DebuggerSupport = false;
102102

103-
/// When set, clobber the Clang instance's virtual file system with the Swift
104-
/// virtual file system.
105-
bool ForceUseSwiftVirtualFileSystem = false;
106-
107103
/// Return a hash code of any components from these options that should
108104
/// contribute to a Swift Bridging PCH hash.
109105
llvm::hash_code getPCHHashComponents() const {

branches/rxwei-patch-1/include/swift/IDE/IDERequestIDZone.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@
1515
//
1616
//===----------------------------------------------------------------------===//
1717
SWIFT_TYPEID(CursorInfoRequest)
18-
SWIFT_TYPEID(RangeInfoRequest)

branches/rxwei-patch-1/include/swift/IDE/IDERequests.h

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
#include "swift/IDE/IDETypeIDs.h"
2424

2525
namespace swift {
26-
//----------------------------------------------------------------------------//
27-
// Cusor info
28-
//----------------------------------------------------------------------------//
2926

3027
// Input for CursorInfoRequest.
3128
// Putting the source file and location together allows us to print the request
@@ -79,67 +76,6 @@ class CursorInfoRequest:
7976
SourceLoc getNearestLoc() const;
8077
};
8178

82-
//----------------------------------------------------------------------------//
83-
// Range info
84-
//----------------------------------------------------------------------------//
85-
86-
// Input for RangeInfoRequest.
87-
// Putting the source file and location together allows us to print the request
88-
// input well e.g. file.swift:3:4
89-
struct RangeInfoOwner {
90-
SourceFile *File;
91-
SourceLoc StartLoc;
92-
SourceLoc EndLoc;
93-
94-
RangeInfoOwner(SourceFile *File, SourceLoc StartLoc, SourceLoc EndLoc):
95-
File(File), StartLoc(StartLoc), EndLoc(EndLoc) {}
96-
RangeInfoOwner(SourceFile *File, unsigned Offset, unsigned Length);
97-
98-
friend llvm::hash_code hash_value(const RangeInfoOwner &CI) {
99-
return hash_combine(hash_value(CI.File),
100-
hash_value(CI.StartLoc.getOpaquePointerValue()),
101-
hash_value(CI.EndLoc.getOpaquePointerValue()));
102-
}
103-
104-
friend bool operator==(const RangeInfoOwner &lhs, const RangeInfoOwner &rhs) {
105-
return lhs.File == rhs.File && lhs.StartLoc == rhs.StartLoc &&
106-
lhs.EndLoc == rhs.EndLoc;
107-
}
108-
109-
friend bool operator!=(const RangeInfoOwner &lhs, const RangeInfoOwner &rhs) {
110-
return !(lhs == rhs);
111-
}
112-
113-
bool isValid() const {
114-
return File && File->getBufferID() && StartLoc.isValid() && EndLoc.isValid();
115-
}
116-
};
117-
118-
void simple_display(llvm::raw_ostream &out, const RangeInfoOwner &owner);
119-
120-
/// Resolve cursor info at a given location.
121-
class RangeInfoRequest:
122-
public SimpleRequest<RangeInfoRequest,
123-
ide::ResolvedRangeInfo(RangeInfoOwner),
124-
CacheKind::Cached>
125-
{
126-
public:
127-
using SimpleRequest::SimpleRequest;
128-
129-
private:
130-
friend SimpleRequest;
131-
132-
// Evaluation.
133-
llvm::Expected<ide::ResolvedRangeInfo> evaluate(Evaluator &evaluator,
134-
RangeInfoOwner CI) const;
135-
136-
public:
137-
// Caching
138-
bool isCached() const { return true; }
139-
// Source location
140-
SourceLoc getNearestLoc() const;
141-
};
142-
14379
/// The zone number for the IDE.
14480
#define SWIFT_IDE_REQUESTS_TYPEID_ZONE 137
14581
#define SWIFT_TYPEID_ZONE SWIFT_IDE_REQUESTS_TYPEID_ZONE

branches/rxwei-patch-1/include/swift/IDE/IDETypeIDZone.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@
1515
//
1616
//===----------------------------------------------------------------------===//
1717
SWIFT_TYPEID_NAMED(ide::ResolvedCursorInfo, ResolvedCursorInfo)
18-
SWIFT_TYPEID_NAMED(ide::ResolvedRangeInfo, ResolvedRangeInfo)

branches/rxwei-patch-1/include/swift/IDE/Utils.h

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -368,26 +368,32 @@ struct ResolvedRangeInfo {
368368
TokensInRange, nullptr, /*Commom Expr Parent*/nullptr,
369369
/*Single entry*/true, /*unhandled error*/false,
370370
OrphanKind::None, {}, {}, {}) {}
371-
ResolvedRangeInfo(): ResolvedRangeInfo(ArrayRef<Token>()) {}
372-
void print(llvm::raw_ostream &OS) const;
371+
void print(llvm::raw_ostream &OS);
373372
ExitState exit() const { return ExitInfo.Exit; }
374373
Type getType() const { return ExitInfo.ReturnType; }
375374

376-
friend bool operator==(const ResolvedRangeInfo &lhs,
377-
const ResolvedRangeInfo &rhs) {
378-
if (lhs.TokensInRange.size() != rhs.TokensInRange.size())
379-
return false;
380-
if (lhs.TokensInRange.empty())
381-
return true;
382-
return lhs.TokensInRange.front().getLoc() ==
383-
rhs.TokensInRange.front().getLoc();
384-
}
385-
386375
private:
387376
static CharSourceRange calculateContentRange(ArrayRef<Token> Tokens);
388377
};
389378

390-
void simple_display(llvm::raw_ostream &out, const ResolvedRangeInfo &info);
379+
class RangeResolver : public SourceEntityWalker {
380+
struct Implementation;
381+
std::unique_ptr<Implementation> Impl;
382+
bool walkToExprPre(Expr *E) override;
383+
bool walkToExprPost(Expr *E) override;
384+
bool walkToStmtPre(Stmt *S) override;
385+
bool walkToStmtPost(Stmt *S) override;
386+
bool walkToDeclPre(Decl *D, CharSourceRange Range) override;
387+
bool walkToDeclPost(Decl *D) override;
388+
bool visitDeclReference(ValueDecl *D, CharSourceRange Range,
389+
TypeDecl *CtorTyRef, ExtensionDecl *ExtTyRef, Type T,
390+
ReferenceMetaData Data) override;
391+
public:
392+
RangeResolver(SourceFile &File, SourceLoc Start, SourceLoc End);
393+
RangeResolver(SourceFile &File, unsigned Offset, unsigned Length);
394+
~RangeResolver();
395+
ResolvedRangeInfo resolve();
396+
};
391397

392398
/// This provides a utility to view a printed name by parsing the components
393399
/// of that name. The components include a base name and an array of argument

branches/rxwei-patch-1/include/swift/Strings.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ struct BuiltinNameStringLiteral {
5454
const StringLiteral literal;
5555

5656
constexpr operator StringRef() const { return literal; }
57-
constexpr const StringRef getWithoutPrefix() const {
57+
58+
StringRef getWithoutPrefix() const {
5859
return literal.drop_front(BUILTIN_TYPE_NAME_PREFIX.size());
5960
}
6061
};

branches/rxwei-patch-1/lib/ClangImporter/ClangImporter.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,11 +1018,10 @@ ClangImporter::create(ASTContext &ctx,
10181018

10191019
// Set up the file manager.
10201020
{
1021-
if (!ctx.SearchPathOpts.VFSOverlayFiles.empty() ||
1022-
importerOpts.ForceUseSwiftVirtualFileSystem) {
1021+
if (!ctx.SearchPathOpts.VFSOverlayFiles.empty()) {
10231022
// If the clang instance has overlays it means the user has provided
1024-
// -ivfsoverlay options. We're going to clobber their file system with
1025-
// the Swift file system, so warn about it.
1023+
// -ivfsoverlay options and swift -vfsoverlay options. We're going to
1024+
// clobber their file system with our own, so warn about it.
10261025
if (!instance.getHeaderSearchOpts().VFSOverlayFiles.empty()) {
10271026
ctx.Diags.diagnose(SourceLoc(), diag::clang_vfs_overlay_is_ignored);
10281027
}

branches/rxwei-patch-1/lib/Frontend/Frontend.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,20 +256,19 @@ static bool loadAndValidateVFSOverlay(
256256
}
257257

258258
bool CompilerInstance::setUpVirtualFileSystemOverlays() {
259-
auto BaseFS = SourceMgr.getFileSystem();
259+
auto BaseFS = llvm::vfs::getRealFileSystem();
260260
auto OverlayFS = llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>(
261261
new llvm::vfs::OverlayFileSystem(BaseFS));
262262
bool hadAnyFailure = false;
263-
bool hasOverlays = false;
264263
for (const auto &File : Invocation.getSearchPathOptions().VFSOverlayFiles) {
265-
hasOverlays = true;
266264
hadAnyFailure |=
267265
loadAndValidateVFSOverlay(File, BaseFS, OverlayFS, Diagnostics);
268266
}
269267

270268
// If we successfully loaded all the overlays, let the source manager and
271269
// diagnostic engine take advantage of the overlay file system.
272-
if (!hadAnyFailure && hasOverlays) {
270+
if (!hadAnyFailure &&
271+
(OverlayFS->overlays_begin() != OverlayFS->overlays_end())) {
273272
SourceMgr.setFileSystem(OverlayFS);
274273
}
275274

0 commit comments

Comments
 (0)