mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Revert "[CodeCompletion] Provide known module source file information"
This effectively reverts commit f8751d466e.
This commit is contained in:
@@ -686,7 +686,6 @@ public:
|
||||
private:
|
||||
CodeCompletionString *CompletionString;
|
||||
StringRef ModuleName;
|
||||
StringRef SourceFilePath;
|
||||
StringRef BriefDocComment;
|
||||
ArrayRef<StringRef> AssociatedUSRs;
|
||||
unsigned TypeDistance : 3;
|
||||
@@ -797,7 +796,7 @@ public:
|
||||
CodeCompletionFlair Flair, unsigned NumBytesToErase,
|
||||
CodeCompletionString *CompletionString,
|
||||
CodeCompletionDeclKind DeclKind, bool IsSystem,
|
||||
StringRef ModuleName, StringRef SourceFilePath,
|
||||
StringRef ModuleName,
|
||||
CodeCompletionResult::NotRecommendedReason NotRecReason,
|
||||
CodeCompletionDiagnosticSeverity diagSeverity,
|
||||
StringRef DiagnosticMessage, StringRef BriefDocComment,
|
||||
@@ -806,10 +805,10 @@ public:
|
||||
CodeCompletionOperatorKind KnownOperatorKind)
|
||||
: Kind(ResultKind::Declaration),
|
||||
KnownOperatorKind(unsigned(KnownOperatorKind)),
|
||||
SemanticContext(unsigned(SemanticContext)), Flair(unsigned(Flair.toRaw())),
|
||||
NotRecommended(unsigned(NotRecReason)), IsSystem(IsSystem),
|
||||
NumBytesToErase(NumBytesToErase), CompletionString(CompletionString),
|
||||
ModuleName(ModuleName), SourceFilePath(SourceFilePath),
|
||||
SemanticContext(unsigned(SemanticContext)),
|
||||
Flair(unsigned(Flair.toRaw())), NotRecommended(unsigned(NotRecReason)),
|
||||
IsSystem(IsSystem), NumBytesToErase(NumBytesToErase),
|
||||
CompletionString(CompletionString), ModuleName(ModuleName),
|
||||
BriefDocComment(BriefDocComment), AssociatedUSRs(AssociatedUSRs),
|
||||
TypeDistance(TypeDistance), DiagnosticSeverity(unsigned(diagSeverity)),
|
||||
DiagnosticMessage(DiagnosticMessage) {
|
||||
@@ -907,10 +906,6 @@ public:
|
||||
return AssociatedUSRs;
|
||||
}
|
||||
|
||||
void setSourceFilePath(StringRef value) {
|
||||
SourceFilePath = value;
|
||||
}
|
||||
|
||||
void setDiagnostics(CodeCompletionDiagnosticSeverity severity, StringRef message) {
|
||||
DiagnosticSeverity = static_cast<unsigned>(severity);
|
||||
DiagnosticMessage = message;
|
||||
@@ -924,12 +919,6 @@ public:
|
||||
return DiagnosticMessage;
|
||||
}
|
||||
|
||||
/// Returns the source file path where the associated decl was declared.
|
||||
/// Returns an empty string if the information is not available.
|
||||
StringRef getSourceFilePath() const {
|
||||
return SourceFilePath;
|
||||
}
|
||||
|
||||
/// Print a debug representation of the code completion result to \p OS.
|
||||
void printPrefix(raw_ostream &OS) const;
|
||||
SWIFT_DEBUG_DUMP;
|
||||
@@ -942,15 +931,6 @@ public:
|
||||
static bool getDeclIsSystem(const Decl *D);
|
||||
};
|
||||
|
||||
/// A pair of a file path and its up-to-date-ness.
|
||||
struct SourceFileAndUpToDate {
|
||||
StringRef FilePath;
|
||||
bool IsUpToDate;
|
||||
|
||||
SourceFileAndUpToDate(StringRef FilePath, bool IsUpToDate)
|
||||
: FilePath(FilePath), IsUpToDate(IsUpToDate) {}
|
||||
};
|
||||
|
||||
struct CodeCompletionResultSink {
|
||||
using AllocatorPtr = std::shared_ptr<llvm::BumpPtrAllocator>;
|
||||
|
||||
@@ -963,13 +943,11 @@ struct CodeCompletionResultSink {
|
||||
|
||||
/// Whether to annotate the results with XML.
|
||||
bool annotateResult = false;
|
||||
bool requiresSourceFileInfo = false;
|
||||
|
||||
/// Whether to emit object literals if desired.
|
||||
bool includeObjectLiterals = true;
|
||||
|
||||
std::vector<CodeCompletionResult *> Results;
|
||||
std::vector<SourceFileAndUpToDate> SourceFiles;
|
||||
|
||||
/// A single-element cache for module names stored in Allocator, keyed by a
|
||||
/// clang::Module * or swift::ModuleDecl *.
|
||||
@@ -1040,9 +1018,6 @@ public:
|
||||
void setAnnotateResult(bool flag) { CurrentResults.annotateResult = flag; }
|
||||
bool getAnnotateResult() const { return CurrentResults.annotateResult; }
|
||||
|
||||
void setRequiresSourceFileInfo(bool flag) { CurrentResults.requiresSourceFileInfo = flag; }
|
||||
bool requiresSourceFileInfo() const { return CurrentResults.requiresSourceFileInfo; }
|
||||
|
||||
void setIncludeObjectLiterals(bool flag) {
|
||||
CurrentResults.includeObjectLiterals = flag;
|
||||
}
|
||||
@@ -1098,7 +1073,6 @@ class PrintingCodeCompletionConsumer
|
||||
bool IncludeComments;
|
||||
bool IncludeSourceText;
|
||||
bool PrintAnnotatedDescription;
|
||||
bool RequiresSourceFileInfo = false;
|
||||
|
||||
public:
|
||||
PrintingCodeCompletionConsumer(llvm::raw_ostream &OS,
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
//===--- ModuleSourceFileInfo.h ---------------------------------*- C++ -*-===//
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2021 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef SWIFT_IDE_MODULESOURCEFILEINFO_H
|
||||
#define SWIFT_IDE_MODULESOURCEFILEINFO_H
|
||||
|
||||
#include "swift/AST/RawComment.h"
|
||||
#include "swift/Basic/BasicSourceInfo.h"
|
||||
#include "swift/Basic/LLVM.h"
|
||||
|
||||
namespace swift {
|
||||
class ASTContext;
|
||||
class Decl;
|
||||
namespace ide {
|
||||
|
||||
/// Get the source file path where \p D is declared. Returns an empty string
|
||||
/// if the information is not available.
|
||||
StringRef getSourceFilePathForDecl(const Decl *D);
|
||||
|
||||
/// Check if the source file of \p info is up-to-date.
|
||||
/// * \c true if the mtime and the size are the same.
|
||||
/// * \c true if the interface has hasn't changed.
|
||||
/// * \c false otherwise.
|
||||
bool isSourceFileUpToDate(const BasicSourceFileInfo &info, ASTContext &Ctx);
|
||||
|
||||
|
||||
} // namespace ide
|
||||
} // namespace swift
|
||||
|
||||
#endif // SWIFT_IDE_MODULESOURCEFILEINFO_H
|
||||
Reference in New Issue
Block a user