Skip to content

Commit

Permalink
Remove fileId from IndexDataMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
jhanssen committed May 26, 2017
1 parent 301a0e4 commit 24c4a44
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/ClangIndexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions src/IndexDataMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ class IndexDataMessage : public RTagsMessage
Flags<IndexerJob::Flag> indexerJobFlags() const { return mIndexerJobFlags; }
void setIndexerJobFlags(Flags<IndexerJob::Flag> 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; }

Expand All @@ -107,7 +104,6 @@ class IndexDataMessage : public RTagsMessage
private:
Path mProject;
uint64_t mParseTime, mId;
uint32_t mFileId;
Flags<IndexerJob::Flag> mIndexerJobFlags; // indexerjobflags
String mMessage; // used as output for dump when flags & Dump
FixIts mFixIts;
Expand All @@ -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<uint32_t>(mSources.size());
for (const Source &source : mSources) {
Expand All @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions src/Project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ void Project::onJobFinished(const std::shared_ptr<IndexerJob> &job, const std::s
{
mBytesWritten += msg->bytesWritten();
std::shared_ptr<IndexerJob> 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();
Expand All @@ -697,7 +697,7 @@ void Project::onJobFinished(const std::shared_ptr<IndexerJob> &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;
Expand All @@ -706,7 +706,7 @@ void Project::onJobFinished(const std::shared_ptr<IndexerJob> &job, const std::s
for (uint32_t file : job->visited) {
if (!validate(file, Validate)) {
releaseFileIds(job->visited);
dirty(job->fileId());
dirty(fileId);
return;
}
}
Expand Down Expand Up @@ -746,10 +746,10 @@ void Project::onJobFinished(const std::shared_ptr<IndexerJob> &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;
});
Expand Down Expand Up @@ -1038,7 +1038,7 @@ void Project::removeDependencies(uint32_t fileId)

void Project::updateDependencies(const std::shared_ptr<IndexDataMessage> &msg)
{
// error() << "updateDependencies" << Location::path(msg->fileId());
// error() << "updateDependencies" << Location::path(fileId);
const bool prune = !(msg->flags() & (IndexDataMessage::InclusionError|IndexDataMessage::ParseFailure));
Set<uint32_t> includeErrors, dirty;
for (auto pair : msg->files()) {
Expand Down

0 comments on commit 24c4a44

Please sign in to comment.