diff options
author | Alex Neundorf <neundorf@kde.org> | 2012-09-30 09:05:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-11-06 16:54:00 (GMT) |
commit | ecc77d09b8996b59bf22bc36e06fa4bb52d665ee (patch) | |
tree | b8015c2e1b769f451ac5307450246e9ffb5ff873 /Source/cmDependsC.cxx | |
parent | 3e7d97d45d167ddab5ebef6a6fd936df3441c4c9 (diff) | |
download | CMake-ecc77d09b8996b59bf22bc36e06fa4bb52d665ee.zip CMake-ecc77d09b8996b59bf22bc36e06fa4bb52d665ee.tar.gz CMake-ecc77d09b8996b59bf22bc36e06fa4bb52d665ee.tar.bz2 |
cmDependsC: fix indentation
This is intentionally a separate commit, so the parent commit which
changes the logic is small and not mixed with formatting (indentation)
changes. So, this patch here does not change any logic.
Alex
Diffstat (limited to 'Source/cmDependsC.cxx')
-rw-r--r-- | Source/cmDependsC.cxx | 210 |
1 files changed, 105 insertions, 105 deletions
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index b760429..6d4ac23 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -132,137 +132,137 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj, } if (!haveDeps) - { - // Walk the dependency graph starting with the source file. - bool first = true; - UnscannedEntry root; - root.FileName = src; - this->Unscanned.push(root); - this->Encountered.clear(); - this->Encountered.insert(src); - std::set<cmStdString> scanned; - - // Use reserve to allocate enough memory for tempPathStr - // so that during the loops no memory is allocated or freed - std::string tempPathStr; - tempPathStr.reserve(4*1024); - - while(!this->Unscanned.empty()) { - // Get the next file to scan. - UnscannedEntry current = this->Unscanned.front(); - this->Unscanned.pop(); - - // If not a full path, find the file in the include path. - std::string fullName; - if(first || cmSystemTools::FileIsFullPath(current.FileName.c_str())) + // Walk the dependency graph starting with the source file. + bool first = true; + UnscannedEntry root; + root.FileName = src; + this->Unscanned.push(root); + this->Encountered.clear(); + this->Encountered.insert(src); + std::set<cmStdString> scanned; + + // Use reserve to allocate enough memory for tempPathStr + // so that during the loops no memory is allocated or freed + std::string tempPathStr; + tempPathStr.reserve(4*1024); + + while(!this->Unscanned.empty()) { - if(cmSystemTools::FileExists(current.FileName.c_str(), true)) + // Get the next file to scan. + UnscannedEntry current = this->Unscanned.front(); + this->Unscanned.pop(); + + // If not a full path, find the file in the include path. + std::string fullName; + if(first || cmSystemTools::FileIsFullPath(current.FileName.c_str())) { - fullName = current.FileName; + if(cmSystemTools::FileExists(current.FileName.c_str(), true)) + { + fullName = current.FileName; + } } - } - else if(!current.QuotedLocation.empty() && - cmSystemTools::FileExists(current.QuotedLocation.c_str(), true)) - { - // The include statement producing this entry was a double-quote - // include and the included file is present in the directory of - // the source containing the include statement. - fullName = current.QuotedLocation; - } - else - { - std::map<cmStdString, cmStdString>::iterator - headerLocationIt=this->HeaderLocationCache.find(current.FileName); - if (headerLocationIt!=this->HeaderLocationCache.end()) + else if(!current.QuotedLocation.empty() && + cmSystemTools::FileExists(current.QuotedLocation.c_str(), true)) { - fullName=headerLocationIt->second; + // The include statement producing this entry was a double-quote + // include and the included file is present in the directory of + // the source containing the include statement. + fullName = current.QuotedLocation; } - else for(std::vector<std::string>::const_iterator i = - this->IncludePath.begin(); i != this->IncludePath.end(); ++i) + else { - // Construct the name of the file as if it were in the current - // include directory. Avoid using a leading "./". - - tempPathStr = ""; - if((*i) == ".") + std::map<cmStdString, cmStdString>::iterator + headerLocationIt=this->HeaderLocationCache.find(current.FileName); + if (headerLocationIt!=this->HeaderLocationCache.end()) { - tempPathStr += current.FileName; + fullName=headerLocationIt->second; } - else + else for(std::vector<std::string>::const_iterator i = + this->IncludePath.begin(); i != this->IncludePath.end(); ++i) { - tempPathStr += *i; - tempPathStr+="/"; - tempPathStr+=current.FileName; - } + // Construct the name of the file as if it were in the current + // include directory. Avoid using a leading "./". - // Look for the file in this location. - if(cmSystemTools::FileExists(tempPathStr.c_str(), true)) - { - fullName = tempPathStr; - HeaderLocationCache[current.FileName]=fullName; - break; + tempPathStr = ""; + if((*i) == ".") + { + tempPathStr += current.FileName; + } + else + { + tempPathStr += *i; + tempPathStr+="/"; + tempPathStr+=current.FileName; + } + + // Look for the file in this location. + if(cmSystemTools::FileExists(tempPathStr.c_str(), true)) + { + fullName = tempPathStr; + HeaderLocationCache[current.FileName]=fullName; + break; + } } } - } - - // Complain if the file cannot be found and matches the complain - // regex. - if(fullName.empty() && - this->IncludeRegexComplain.find(current.FileName.c_str())) - { - cmSystemTools::Error("Cannot find file \"", - current.FileName.c_str(), "\"."); - return false; - } - // Scan the file if it was found and has not been scanned already. - if(!fullName.empty() && (scanned.find(fullName) == scanned.end())) - { - // Record scanned files. - scanned.insert(fullName); + // Complain if the file cannot be found and matches the complain + // regex. + if(fullName.empty() && + this->IncludeRegexComplain.find(current.FileName.c_str())) + { + cmSystemTools::Error("Cannot find file \"", + current.FileName.c_str(), "\"."); + return false; + } - // Check whether this file is already in the cache - std::map<cmStdString, cmIncludeLines*>::iterator fileIt= - this->FileCache.find(fullName); - if (fileIt!=this->FileCache.end()) + // Scan the file if it was found and has not been scanned already. + if(!fullName.empty() && (scanned.find(fullName) == scanned.end())) { - fileIt->second->Used=true; - dependencies.insert(fullName); - for (std::vector<UnscannedEntry>::const_iterator incIt= - fileIt->second->UnscannedEntries.begin(); - incIt!=fileIt->second->UnscannedEntries.end(); ++incIt) + // Record scanned files. + scanned.insert(fullName); + + // Check whether this file is already in the cache + std::map<cmStdString, cmIncludeLines*>::iterator fileIt= + this->FileCache.find(fullName); + if (fileIt!=this->FileCache.end()) { - if (this->Encountered.find(incIt->FileName) == - this->Encountered.end()) + fileIt->second->Used=true; + dependencies.insert(fullName); + for (std::vector<UnscannedEntry>::const_iterator incIt= + fileIt->second->UnscannedEntries.begin(); + incIt!=fileIt->second->UnscannedEntries.end(); ++incIt) { - this->Encountered.insert(incIt->FileName); - this->Unscanned.push(*incIt); + if (this->Encountered.find(incIt->FileName) == + this->Encountered.end()) + { + this->Encountered.insert(incIt->FileName); + this->Unscanned.push(*incIt); + } } } - } - else - { - - // Try to scan the file. Just leave it out if we cannot find - // it. - std::ifstream fin(fullName.c_str()); - if(fin) + else { - // Add this file as a dependency. - dependencies.insert(fullName); - // Scan this file for new dependencies. Pass the directory - // containing the file to handle double-quote includes. - std::string dir = cmSystemTools::GetFilenamePath(fullName); - this->Scan(fin, dir.c_str(), fullName); + // Try to scan the file. Just leave it out if we cannot find + // it. + std::ifstream fin(fullName.c_str()); + if(fin) + { + // Add this file as a dependency. + dependencies.insert(fullName); + + // Scan this file for new dependencies. Pass the directory + // containing the file to handle double-quote includes. + std::string dir = cmSystemTools::GetFilenamePath(fullName); + this->Scan(fin, dir.c_str(), fullName); + } } } - } - first = false; + first = false; + } } - } // Write the dependencies to the output stream. Makefile rules // written by the original local generator for this directory |