diff --git a/src/ClangIndexer.cpp b/src/ClangIndexer.cpp index fc90c52ab..9113beaec 100644 --- a/src/ClangIndexer.cpp +++ b/src/ClangIndexer.cpp @@ -204,7 +204,6 @@ bool ClangIndexer::exec(const String &data) mIndexDataMessage.setProject(mProject); mIndexDataMessage.setIndexerJobFlags(indexerJobFlags); mIndexDataMessage.setParseTime(parseTime); - mIndexDataMessage.setFileId(mSources.front().fileId); mIndexDataMessage.setId(id); assert(mConnection->isConnected()); @@ -336,7 +335,7 @@ Location ClangIndexer::createLocation(const Path &sourceFile, unsigned int line, } ++mFileIdsQueried; - VisitFileMessage msg(resolved, mProject, mIndexDataMessage.fileId()); + VisitFileMessage msg(resolved, mProject, mSources.front().fileId); mVisitFileResponseMessageFileId = UINT_MAX; mVisitFileResponseMessageVisit = false; diff --git a/src/IndexDataMessage.h b/src/IndexDataMessage.h index 887d684cb..86ffff524 100644 --- a/src/IndexDataMessage.h +++ b/src/IndexDataMessage.h @@ -81,9 +81,6 @@ class IndexDataMessage : public RTagsMessage Flags indexerJobFlags() const { return mIndexerJobFlags; } void setIndexerJobFlags(Flags flags) { mIndexerJobFlags = flags; } - uint32_t fileId() const { return mFileId; } - void setFileId(uint32_t id) { mFileId = id; } - const String &message() const { return mMessage; } void setMessage(const String &msg) { mMessage = msg; } @@ -107,7 +104,6 @@ class IndexDataMessage : public RTagsMessage private: Path mProject; uint64_t mParseTime, mId; - uint32_t mFileId; Flags mIndexerJobFlags; // indexerjobflags String mMessage; // used as output for dump when flags & Dump FixIts mFixIts; @@ -124,7 +120,7 @@ RCT_FLAGS(IndexDataMessage::FileFlag); inline void IndexDataMessage::encode(Serializer &serializer) const { - serializer << mProject << mParseTime << mFileId << mId << mIndexerJobFlags << mMessage + serializer << mProject << mParseTime << mId << mIndexerJobFlags << mMessage << mFixIts << mIncludes << mDiagnostics << mFiles << mFlags << mBytesWritten << static_cast(mSources.size()); for (const Source &source : mSources) { @@ -134,7 +130,7 @@ inline void IndexDataMessage::encode(Serializer &serializer) const inline void IndexDataMessage::decode(Deserializer &deserializer) { - deserializer >> mProject >> mParseTime >> mFileId >> mId >> mIndexerJobFlags >> mMessage + deserializer >> mProject >> mParseTime >> mId >> mIndexerJobFlags >> mMessage >> mFixIts >> mIncludes >> mDiagnostics >> mFiles >> mFlags >> mBytesWritten; uint32_t size; diff --git a/src/Project.cpp b/src/Project.cpp index dfab9039e..48e7556e4 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -678,7 +678,7 @@ void Project::onJobFinished(const std::shared_ptr &job, const std::s { mBytesWritten += msg->bytesWritten(); std::shared_ptr restart; - const uint32_t fileId = msg->fileId(); + const uint32_t fileId = job->fileId(); auto j = mActiveJobs.take(fileId); if (!j) { error() << "Couldn't find JobData for" << Location::path(fileId) << msg->id() << job->id << job.get(); @@ -697,7 +697,7 @@ void Project::onJobFinished(const std::shared_ptr &job, const std::s releaseFileIds(job->visited); } - if (!hasSource(msg->fileId())) { + if (!hasSource(fileId)) { releaseFileIds(job->visited); error() << "Can't find source for" << Location::path(fileId); return; @@ -706,7 +706,7 @@ void Project::onJobFinished(const std::shared_ptr &job, const std::s for (uint32_t file : job->visited) { if (!validate(file, Validate)) { releaseFileIds(job->visited); - dirty(job->fileId()); + dirty(fileId); return; } } @@ -746,10 +746,10 @@ void Project::onJobFinished(const std::shared_ptr &job, const std::s updateFixIts(visited, msg->fixIts()); updateDependencies(msg); if (success) { - forEachSources([&msg](Sources &sources) -> VisitResult { - // error() << "finished with" << Location::path(msg->fileId()) << sources.contains(msg->fileId()) << msg->parseTime(); - if (sources.contains(msg->fileId())) { - sources[msg->fileId()].parsed = msg->parseTime(); + forEachSources([&msg, fileId](Sources &sources) -> VisitResult { + // error() << "finished with" << Location::path(fileId) << sources.contains(fileId) << msg->parseTime(); + if (sources.contains(fileId)) { + sources[fileId].parsed = msg->parseTime(); } return Continue; }); @@ -1038,7 +1038,7 @@ void Project::removeDependencies(uint32_t fileId) void Project::updateDependencies(const std::shared_ptr &msg) { - // error() << "updateDependencies" << Location::path(msg->fileId()); + // error() << "updateDependencies" << Location::path(fileId); const bool prune = !(msg->flags() & (IndexDataMessage::InclusionError|IndexDataMessage::ParseFailure)); Set includeErrors, dirty; for (auto pair : msg->files()) {