Merge pull request #29741 from hamishknight/moving-states

Move PersistentParserState onto SourceFile
This commit is contained in:
Hamish Knight
2020-03-02 14:11:06 -08:00
committed by GitHub
18 changed files with 170 additions and 111 deletions

View File

@@ -400,8 +400,6 @@ class CompilerInstance {
std::unique_ptr<Lowering::TypeConverter> TheSILTypes;
std::unique_ptr<SILModule> TheSILModule;
std::unique_ptr<PersistentParserState> PersistentState;
/// Null if no tracker.
std::unique_ptr<DependencyTracker> DepTracker;
/// If there is no stats output directory by the time the
@@ -431,6 +429,9 @@ class CompilerInstance {
/// buffer will also have its buffer ID in PrimaryBufferIDs.
std::vector<SourceFile *> PrimarySourceFiles;
/// The file that has been registered for code completion.
NullablePtr<SourceFile> CodeCompletionFile;
/// Return whether there is an entry in PrimaryInputs for buffer \p BufID.
bool isPrimaryInput(unsigned BufID) const {
return PrimaryBufferIDs.count(BufID) != 0;
@@ -550,12 +551,13 @@ public:
return Invocation;
}
bool hasPersistentParserState() const {
return bool(PersistentState);
}
/// If a code completion buffer has been set, returns the corresponding source
/// file.
NullablePtr<SourceFile> getCodeCompletionFile() { return CodeCompletionFile; }
PersistentParserState &getPersistentParserState() {
return *PersistentState.get();
/// Set a new file that we're performing code completion on.
void setCodeCompletionFile(SourceFile *file) {
CodeCompletionFile = file;
}
private: