From 5b092dc9dac64c5119592ea02c576bbeae913a14 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Wed, 17 Jan 2018 23:24:52 -0800 Subject: [PATCH] Rename variable --- src/import_pipeline.cc | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/import_pipeline.cc b/src/import_pipeline.cc index 618a7d0b..899dc8b4 100644 --- a/src/import_pipeline.cc +++ b/src/import_pipeline.cc @@ -182,18 +182,18 @@ std::vector ParseFile( // If the file is inferred, we may not actually be able to parse that file // directly (ie, a header file, which are not listed in the project). If this // file is inferred, then try to use the file which originally imported it. - std::string path = entry.filename; + std::string path_to_index = entry.filename; if (entry.is_inferred) { IndexFile* entry_cache = cache_manager->TryLoad(entry.filename); if (entry_cache) - path = entry_cache->import_file; + path_to_index = entry_cache->import_file; } std::vector result; // Always run this block, even if we are interactive, so we can check // dependencies and reset files in |file_consumer_shared|. - IndexFile* previous_index = cache_manager->TryLoad(path); + IndexFile* previous_index = cache_manager->TryLoad(path_to_index); if (previous_index) { // If none of the dependencies have changed and the index is not // interactive (ie, requested by a file save), skip parsing and just load @@ -203,7 +203,7 @@ std::vector ParseFile( ShouldParse path_state = FileNeedsParse( is_interactive, timestamp_manager, modification_timestamp_fetcher, import_manager, cache_manager, file_consumer_shared, previous_index, - path, entry.args, nullopt); + path_to_index, entry.args, nullopt); // Target file does not exist on disk, do not emit any indexes. // TODO: Dependencies should be reassigned to other files. We can do this by @@ -231,12 +231,14 @@ std::vector ParseFile( // No timestamps changed - load directly from cache. if (!needs_reparse) { - LOG_S(INFO) << "Skipping parse; no timestamp change for " << path; + LOG_S(INFO) << "Skipping parse; no timestamp change for " + << path_to_index; // TODO/FIXME: real perf PerformanceImportFile perf; - result.push_back(Index_DoIdMap(cache_manager->TakeOrLoad(path), perf, - is_interactive, false /*write_to_disk*/)); + result.push_back(Index_DoIdMap(cache_manager->TakeOrLoad(path_to_index), + perf, is_interactive, + false /*write_to_disk*/)); for (const std::string& dependency : previous_index->dependencies) { // Only load a dependency if it is not already loaded. // @@ -264,7 +266,7 @@ std::vector ParseFile( } } - LOG_S(INFO) << "Parsing " << path; + LOG_S(INFO) << "Parsing " << path_to_index; // Load file contents for all dependencies into memory. If the dependencies // for the file changed we may not end up using all of the files we @@ -277,7 +279,7 @@ std::vector ParseFile( // TODO: We might be able to optimize perf by only copying for files in // working_files. We can pass that same set of files to the indexer as // well. We then default to a fast file-copy if not in working set. - bool loaded_primary = contents.path == path; + bool loaded_primary = contents.path == path_to_index; std::vector file_contents = {contents}; cache_manager->IterateLoadedCaches([&](IndexFile* index) { // FIXME: ReadContent should go through |cache_manager|. @@ -289,20 +291,22 @@ std::vector ParseFile( file_contents.push_back(FileContents(index->path, *index_content)); - loaded_primary = loaded_primary || index->path == path; + loaded_primary = loaded_primary || index->path == path_to_index; }); if (!loaded_primary) { - optional content = ReadContent(path); + optional content = ReadContent(path_to_index); if (!content) { - LOG_S(ERROR) << "Skipping index (file cannot be found): " << path; + LOG_S(ERROR) << "Skipping index (file cannot be found): " + << path_to_index; return result; } - file_contents.push_back(FileContents(path, *content)); + file_contents.push_back(FileContents(path_to_index, *content)); } PerformanceImportFile perf; - std::vector> indexes = indexer->Index( - config, file_consumer_shared, path, entry.args, file_contents, &perf); + std::vector> indexes = + indexer->Index(config, file_consumer_shared, path_to_index, entry.args, + file_contents, &perf); for (std::unique_ptr& new_index : indexes) { Timer time;