Skip to content

Commit 58aaa4f

Browse files
authored
Merge pull request #62522 from ahoppen/ahoppen/rename-completion
[IDE] Rename CodeCompletion to IDEInspection in cases where the code path no longer exclusively applies to code completion
2 parents c35d05c + fe2ae72 commit 58aaa4f

Some content is hidden

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

61 files changed

+639
-624
lines changed

include/swift/AST/ASTTypeIDZone.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ SWIFT_TYPEID(Witness)
4444
SWIFT_TYPEID_NAMED(AbstractFunctionDecl *, AbstractFunctionDecl)
4545
SWIFT_TYPEID_NAMED(ApplyExpr *, ApplyExpr)
4646
SWIFT_TYPEID_NAMED(ClosureExpr *, ClosureExpr)
47-
SWIFT_TYPEID_NAMED(CodeCompletionCallbacksFactory *,
48-
CodeCompletionCallbacksFactory)
47+
SWIFT_TYPEID_NAMED(IDEInspectionCallbacksFactory *,
48+
IDEInspectionCallbacksFactory)
4949
SWIFT_TYPEID_NAMED(ConstructorDecl *, ConstructorDecl)
5050
SWIFT_TYPEID_NAMED(CustomAttr *, CustomAttr)
5151
SWIFT_TYPEID_NAMED(ConstValueTypeInfo *, ConstValueTypeInfo)

include/swift/AST/ASTTypeIDs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ enum class BodyInitKind;
2929
struct BodyInitKindAndExpr;
3030
class BraceStmt;
3131
class ClosureExpr;
32-
class CodeCompletionCallbacksFactory;
32+
class IDEInspectionCallbacksFactory;
3333
class ConstructorDecl;
3434
class CustomAttr;
3535
class Decl;

include/swift/AST/ParseRequests.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@ class ParseTopLevelDeclsRequest
136136
};
137137

138138
void simple_display(llvm::raw_ostream &out,
139-
const CodeCompletionCallbacksFactory *factory);
139+
const IDEInspectionCallbacksFactory *factory);
140140

141-
class CodeCompletionSecondPassRequest
142-
: public SimpleRequest<CodeCompletionSecondPassRequest,
143-
bool(SourceFile *, CodeCompletionCallbacksFactory *),
141+
class IDEInspectionSecondPassRequest
142+
: public SimpleRequest<IDEInspectionSecondPassRequest,
143+
bool(SourceFile *, IDEInspectionCallbacksFactory *),
144144
RequestFlags::Uncached|RequestFlags::DependencySource> {
145145
public:
146146
using SimpleRequest::SimpleRequest;
@@ -150,7 +150,7 @@ class CodeCompletionSecondPassRequest
150150

151151
// Evaluation.
152152
bool evaluate(Evaluator &evaluator, SourceFile *SF,
153-
CodeCompletionCallbacksFactory *Factory) const;
153+
IDEInspectionCallbacksFactory *Factory) const;
154154

155155
public:
156156
evaluator::DependencySource

include/swift/AST/ParseTypeIDZone.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
//
1515
//===----------------------------------------------------------------------===//
1616

17-
SWIFT_REQUEST(Parse, CodeCompletionSecondPassRequest,
18-
bool (SourceFile *, CodeCompletionCallbacksFactory *),
17+
SWIFT_REQUEST(Parse, IDEInspectionSecondPassRequest,
18+
bool (SourceFile *, IDEInspectionCallbacksFactory *),
1919
Uncached, NoLocationInfo)
2020
SWIFT_REQUEST(Parse, ParseMembersRequest,
2121
FingerprintAndMembers(IterableDeclContext *), Cached, NoLocationInfo)

include/swift/AST/TypeCheckRequests.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3340,8 +3340,8 @@ class PrimarySourceFilesRequest
33403340
/// Retrieve the file being used for code completion in the main module.
33413341
// FIXME: This isn't really a type-checking request, if we ever split off a
33423342
// zone for more basic AST requests, this should be moved there.
3343-
class CodeCompletionFileRequest
3344-
: public SimpleRequest<CodeCompletionFileRequest,
3343+
class IDEInspectionFileRequest
3344+
: public SimpleRequest<IDEInspectionFileRequest,
33453345
SourceFile *(ModuleDecl *), RequestFlags::Cached> {
33463346
public:
33473347
using SimpleRequest::SimpleRequest;

include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ SWIFT_REQUEST(TypeChecker, CheckRedeclarationRequest,
4242
Uncached, NoLocationInfo)
4343
SWIFT_REQUEST(TypeChecker, ClassAncestryFlagsRequest,
4444
AncestryFlags(ClassDecl *), Cached, NoLocationInfo)
45-
SWIFT_REQUEST(TypeChecker, CodeCompletionFileRequest,
45+
SWIFT_REQUEST(TypeChecker, IDEInspectionFileRequest,
4646
SourceFile *(ModuleDecl *), Cached, NoLocationInfo)
4747
SWIFT_REQUEST(TypeChecker, CompareDeclSpecializationRequest,
4848
bool (DeclContext *, ValueDecl *, ValueDecl *, bool), Cached,

include/swift/Basic/SourceManager.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class SourceManager {
3939
private:
4040
llvm::SourceMgr LLVMSourceMgr;
4141
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FileSystem;
42-
unsigned CodeCompletionBufferID = 0U;
43-
unsigned CodeCompletionOffset;
42+
unsigned IDEInspectionTargetBufferID = 0U;
43+
unsigned IDEInspectionTargetOffset;
4444

4545
/// Associates buffer identifiers to buffer IDs.
4646
llvm::DenseMap<StringRef, unsigned> BufIdentIDMap;
@@ -84,26 +84,26 @@ class SourceManager {
8484
return FileSystem;
8585
}
8686

87-
void setCodeCompletionPoint(unsigned BufferID, unsigned Offset) {
87+
void setIDEInspectionTarget(unsigned BufferID, unsigned Offset) {
8888
assert(BufferID != 0U && "Buffer should be valid");
8989

90-
CodeCompletionBufferID = BufferID;
91-
CodeCompletionOffset = Offset;
90+
IDEInspectionTargetBufferID = BufferID;
91+
IDEInspectionTargetOffset = Offset;
9292
}
9393

94-
bool hasCodeCompletionBuffer() const {
95-
return CodeCompletionBufferID != 0U;
94+
bool hasIDEInspectionTargetBuffer() const {
95+
return IDEInspectionTargetBufferID != 0U;
9696
}
9797

98-
unsigned getCodeCompletionBufferID() const {
99-
return CodeCompletionBufferID;
98+
unsigned getIDEInspectionTargetBufferID() const {
99+
return IDEInspectionTargetBufferID;
100100
}
101101

102-
unsigned getCodeCompletionOffset() const {
103-
return CodeCompletionOffset;
102+
unsigned getIDEInspectionTargetOffset() const {
103+
return IDEInspectionTargetOffset;
104104
}
105105

106-
SourceLoc getCodeCompletionLoc() const;
106+
SourceLoc getIDEInspectionTargetLoc() const;
107107

108108
const llvm::DenseMap<SourceRange, SourceRange> &getReplacedRanges() const {
109109
return ReplacedRanges;
@@ -142,9 +142,9 @@ class SourceManager {
142142
}
143143

144144
/// Returns true if range \p R contains the code-completion location, if any.
145-
bool rangeContainsCodeCompletionLoc(SourceRange R) const {
146-
return CodeCompletionBufferID
147-
? rangeContainsTokenLoc(R, getCodeCompletionLoc())
145+
bool rangeContainsIDEInspectionTarget(SourceRange R) const {
146+
return IDEInspectionTargetBufferID
147+
? rangeContainsTokenLoc(R, getIDEInspectionTargetLoc())
148148
: false;
149149
}
150150

include/swift/Frontend/Frontend.h

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "swift/Frontend/ModuleInterfaceSupport.h"
3636
#include "swift/IRGen/TBDGen.h"
3737
#include "swift/Migrator/MigratorOptions.h"
38-
#include "swift/Parse/CodeCompletionCallbacks.h"
38+
#include "swift/Parse/IDEInspectionCallbacks.h"
3939
#include "swift/Parse/Parser.h"
4040
#include "swift/Sema/SourceLoader.h"
4141
#include "swift/Serialization/Validation.h"
@@ -95,13 +95,14 @@ class CompilerInvocation {
9595
IRGenOptions IRGenOpts;
9696
TBDGenOptions TBDGenOpts;
9797
ModuleInterfaceOptions ModuleInterfaceOpts;
98-
llvm::MemoryBuffer *CodeCompletionBuffer = nullptr;
98+
llvm::MemoryBuffer *IDEInspectionTargetBuffer = nullptr;
9999

100-
/// Code completion offset in bytes from the beginning of the main
101-
/// source file. Valid only if \c isCodeCompletion() == true.
102-
unsigned CodeCompletionOffset = ~0U;
100+
/// The offset that IDEInspection wants to further examine in offset of bytes
101+
/// from the beginning of the main source file. Valid only if
102+
/// \c isIDEInspection() == true.
103+
unsigned IDEInspectionOffset = ~0U;
103104

104-
CodeCompletionCallbacksFactory *CodeCompletionFactory = nullptr;
105+
IDEInspectionCallbacksFactory *IDEInspectionFactory = nullptr;
105106

106107
public:
107108
CompilerInvocation();
@@ -322,22 +323,22 @@ class CompilerInvocation {
322323
return FrontendOpts.InputsAndOutputs.getSingleOutputFilename();
323324
}
324325

325-
void setCodeCompletionPoint(llvm::MemoryBuffer *Buf, unsigned Offset) {
326+
void setIDEInspectionTarget(llvm::MemoryBuffer *Buf, unsigned Offset) {
326327
assert(Buf);
327-
CodeCompletionBuffer = Buf;
328-
CodeCompletionOffset = Offset;
328+
IDEInspectionTargetBuffer = Buf;
329+
IDEInspectionOffset = Offset;
329330
// We don't need typo-correction for code-completion.
330331
// FIXME: This isn't really true, but is a performance issue.
331332
LangOpts.TypoCorrectionLimit = 0;
332333
}
333334

334-
std::pair<llvm::MemoryBuffer *, unsigned> getCodeCompletionPoint() const {
335-
return std::make_pair(CodeCompletionBuffer, CodeCompletionOffset);
335+
std::pair<llvm::MemoryBuffer *, unsigned> getIDEInspectionTarget() const {
336+
return std::make_pair(IDEInspectionTargetBuffer, IDEInspectionOffset);
336337
}
337338

338339
/// \returns true if we are doing code completion.
339-
bool isCodeCompletion() const {
340-
return CodeCompletionOffset != ~0U;
340+
bool isIDEInspection() const {
341+
return IDEInspectionOffset != ~0U;
341342
}
342343

343344
/// Retrieve a module hash string that is suitable for uniquely
@@ -588,9 +589,9 @@ class CompilerInstance {
588589

589590
const CompilerInvocation &getInvocation() const { return Invocation; }
590591

591-
/// If a code completion buffer has been set, returns the corresponding source
592+
/// If a IDE inspection buffer has been set, returns the corresponding source
592593
/// file.
593-
SourceFile *getCodeCompletionFile() const;
594+
SourceFile *getIDEInspectionFile() const;
594595

595596
private:
596597
/// Set up the file system by loading and validating all VFS overlay YAML
@@ -609,7 +610,7 @@ class CompilerInstance {
609610
/// \return false if successful, true on error.
610611
bool setupDiagnosticVerifierIfNeeded();
611612

612-
Optional<unsigned> setUpCodeCompletionBuffer();
613+
Optional<unsigned> setUpIDEInspectionTargetBuffer();
613614

614615
/// Find a buffer for a given input file and ensure it is recorded in
615616
/// SourceMgr, PartialModules, or InputSourceCodeBufferIDs as appropriate.

include/swift/IDE/CodeCompletion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "swift/IDE/CompletionLookup.h"
2121

2222
namespace swift {
23-
class CodeCompletionCallbacksFactory;
23+
class IDEInspectionCallbacksFactory;
2424
class Decl;
2525
class DeclContext;
2626
class FrontendOptions;
@@ -70,7 +70,7 @@ void deliverCompletionResults(CodeCompletionContext &CompletionContext,
7070
CodeCompletionConsumer &Consumer);
7171

7272
/// Create a factory for code completion callbacks.
73-
CodeCompletionCallbacksFactory *
73+
IDEInspectionCallbacksFactory *
7474
makeCodeCompletionCallbacksFactory(CodeCompletionContext &CompletionContext,
7575
CodeCompletionConsumer &Consumer);
7676

include/swift/IDE/CodeCompletionConsumer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define SWIFT_IDE_CODECOMPLETIONCONSUMER
1515

1616
#include "swift/IDE/CodeCompletionContext.h"
17-
#include "swift/Parse/CodeCompletionCallbacks.h"
17+
#include "swift/Parse/IDEInspectionCallbacks.h"
1818

1919
namespace swift {
2020
namespace ide {

include/swift/IDE/CompletionLookup.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "swift/IDE/CodeCompletionResult.h"
2727
#include "swift/IDE/CodeCompletionStringPrinter.h"
2828
#include "swift/IDE/PossibleParamInfo.h"
29-
#include "swift/Parse/CodeCompletionCallbacks.h"
29+
#include "swift/Parse/IDEInspectionCallbacks.h"
3030
#include "swift/Sema/IDETypeChecking.h"
3131
#include "swift/Strings.h"
3232

@@ -616,7 +616,8 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
616616

617617
void collectPrecedenceGroups();
618618

619-
void getPrecedenceGroupCompletions(CodeCompletionCallbacks::PrecedenceGroupCompletionKind SK);
619+
void getPrecedenceGroupCompletions(
620+
IDEInspectionCallbacks::PrecedenceGroupCompletionKind SK);
620621

621622
void getPoundAvailablePlatformCompletions();
622623

include/swift/IDE/ConformingMethodList.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "swift/Basic/LLVM.h"
1818

1919
namespace swift {
20-
class CodeCompletionCallbacksFactory;
20+
class IDEInspectionCallbacksFactory;
2121

2222
namespace ide {
2323

@@ -45,7 +45,7 @@ class ConformingMethodListConsumer {
4545
};
4646

4747
/// Create a factory for code completion callbacks.
48-
CodeCompletionCallbacksFactory *makeConformingMethodListCallbacksFactory(
48+
IDEInspectionCallbacksFactory *makeConformingMethodListCallbacksFactory(
4949
ArrayRef<const char *> expectedTypeNames,
5050
ConformingMethodListConsumer &Consumer);
5151

include/swift/IDE/CursorInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "swift/IDE/Utils.h"
1919

2020
namespace swift {
21-
class CodeCompletionCallbacksFactory;
21+
class IDEInspectionCallbacksFactory;
2222

2323
namespace ide {
2424

@@ -30,7 +30,7 @@ class CursorInfoConsumer {
3030
};
3131

3232
/// Create a factory for code completion callbacks.
33-
CodeCompletionCallbacksFactory *
33+
IDEInspectionCallbacksFactory *
3434
makeCursorInfoCallbacksFactory(CursorInfoConsumer &Consumer,
3535
SourceLoc RequestedLoc);
3636

include/swift/IDE/REPLCodeCompletion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "swift/Basic/LLVM.h"
2121
#include "swift/IDE/CodeCompletionCache.h"
2222
#include "swift/IDE/CodeCompletionConsumer.h"
23-
#include "swift/Parse/CodeCompletionCallbacks.h"
23+
#include "swift/Parse/IDEInspectionCallbacks.h"
2424
#include "llvm/ADT/ArrayRef.h"
2525
#include "llvm/ADT/StringRef.h"
2626
#include <memory>
@@ -63,7 +63,7 @@ class REPLCompletions {
6363
ide::CodeCompletionCache CompletionCache;
6464
ide::CodeCompletionContext CompletionContext;
6565
std::unique_ptr<ide::CodeCompletionConsumer> Consumer;
66-
std::unique_ptr<CodeCompletionCallbacksFactory> CompletionCallbacksFactory;
66+
std::unique_ptr<IDEInspectionCallbacksFactory> IDEInspectionCallbacksFactory;
6767

6868
std::vector<StringRef> CompletionStrings;
6969
std::vector<CookedResult> CookedResults;

include/swift/IDE/TypeContextInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "swift/Basic/LLVM.h"
1818

1919
namespace swift {
20-
class CodeCompletionCallbacksFactory;
20+
class IDEInspectionCallbacksFactory;
2121

2222
namespace ide {
2323

@@ -41,7 +41,7 @@ class TypeContextInfoConsumer {
4141
};
4242

4343
/// Create a factory for code completion callbacks.
44-
CodeCompletionCallbacksFactory *
44+
IDEInspectionCallbacksFactory *
4545
makeTypeContextInfoCallbacksFactory(TypeContextInfoConsumer &Consumer);
4646

4747
} // namespace ide

0 commit comments

Comments
 (0)