diff options
author | Tushar Maheshwari <tushar27192@gmail.com> | 2019-09-08 10:50:06 (GMT) |
---|---|---|
committer | Tushar Maheshwari <tushar27192@gmail.com> | 2019-09-20 15:09:43 (GMT) |
commit | 8d0cec747cfbad582119c590efc8c390b6f2bbc0 (patch) | |
tree | 7622e8e6753240ec68d6608ed12bb246b7585f98 | |
parent | ebb9346490741ddc2ce6f552bc1be57dfc730cfa (diff) | |
download | CMake-8d0cec747cfbad582119c590efc8c390b6f2bbc0.zip CMake-8d0cec747cfbad582119c590efc8c390b6f2bbc0.tar.gz CMake-8d0cec747cfbad582119c590efc8c390b6f2bbc0.tar.bz2 |
cmDependsC: remove cmDeleteAll call
-rw-r--r-- | Source/cmDependsC.cxx | 20 | ||||
-rw-r--r-- | Source/cmDependsC.h | 2 |
2 files changed, 9 insertions, 13 deletions
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index a380b41..012a0b1 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -5,7 +5,6 @@ #include "cmsys/FStream.hxx" #include <utility> -#include "cmAlgorithms.h" #include "cmFileTime.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" @@ -67,7 +66,6 @@ cmDependsC::cmDependsC(cmLocalGenerator* lg, const std::string& targetDir, cmDependsC::~cmDependsC() { this->WriteCacheFile(); - cmDeleteAll(this->FileCache); } bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, @@ -172,9 +170,9 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, // Check whether this file is already in the cache auto fileIt = this->FileCache.find(fullName); if (fileIt != this->FileCache.end()) { - fileIt->second->Used = true; + fileIt->second.Used = true; dependencies.insert(fullName); - for (UnscannedEntry const& inc : fileIt->second->UnscannedEntries) { + for (UnscannedEntry const& inc : fileIt->second.UnscannedEntries) { if (this->Encountered.find(inc.FileName) == this->Encountered.end()) { this->Encountered.insert(inc.FileName); @@ -260,8 +258,7 @@ void cmDependsC::ReadCacheFile() if (res && newer) // cache is newer than the parsed file { - cacheEntry = new cmIncludeLines; - this->FileCache[line] = cacheEntry; + cacheEntry = &this->FileCache[line]; } // file doesn't exist, check that the regular expressions // haven't changed @@ -313,10 +310,10 @@ void cmDependsC::WriteCacheFile() const cacheOut << this->IncludeRegexTransformString << "\n\n"; for (auto const& fileIt : this->FileCache) { - if (fileIt.second->Used) { + if (fileIt.second.Used) { cacheOut << fileIt.first << std::endl; - for (UnscannedEntry const& inc : fileIt.second->UnscannedEntries) { + for (UnscannedEntry const& inc : fileIt.second.UnscannedEntries) { cacheOut << inc.FileName << std::endl; if (inc.QuotedLocation.empty()) { cacheOut << "-" << std::endl; @@ -332,9 +329,8 @@ void cmDependsC::WriteCacheFile() const void cmDependsC::Scan(std::istream& is, const std::string& directory, const std::string& fullName) { - cmIncludeLines* newCacheEntry = new cmIncludeLines; - newCacheEntry->Used = true; - this->FileCache[fullName] = newCacheEntry; + cmIncludeLines& newCacheEntry = this->FileCache[fullName]; + newCacheEntry.Used = true; // Read one line at a time. std::string line; @@ -370,7 +366,7 @@ void cmDependsC::Scan(std::istream& is, const std::string& directory, // This kind of problem will be fixed when a more // preprocessor-like implementation of this scanner is created. if (this->IncludeRegexScan.find(entry.FileName)) { - newCacheEntry->UnscannedEntries.push_back(entry); + newCacheEntry.UnscannedEntries.push_back(entry); if (this->Encountered.find(entry.FileName) == this->Encountered.end()) { this->Encountered.insert(entry.FileName); diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index cbdc276..7d732d9 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -84,7 +84,7 @@ protected: std::set<std::string> Encountered; std::queue<UnscannedEntry> Unscanned; - std::map<std::string, cmIncludeLines*> FileCache; + std::map<std::string, cmIncludeLines> FileCache; std::map<std::string, std::string> HeaderLocationCache; std::string CacheFileName; |