summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmParseMumpsCoverage.cxx
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 14:34:04 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-16 20:05:19 (GMT)
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Source/CTest/cmParseMumpsCoverage.cxx
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadCMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
Diffstat (limited to 'Source/CTest/cmParseMumpsCoverage.cxx')
-rw-r--r--Source/CTest/cmParseMumpsCoverage.cxx114
1 files changed, 45 insertions, 69 deletions
diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx
index d0c7599..e5dd74a 100644
--- a/Source/CTest/cmParseMumpsCoverage.cxx
+++ b/Source/CTest/cmParseMumpsCoverage.cxx
@@ -7,11 +7,10 @@
#include <stdio.h>
#include <stdlib.h>
-
cmParseMumpsCoverage::cmParseMumpsCoverage(
- cmCTestCoverageHandlerContainer& cont,
- cmCTest* ctest)
- :Coverage(cont), CTest(ctest)
+ cmCTestCoverageHandlerContainer& cont, cmCTest* ctest)
+ : Coverage(cont)
+ , CTest(ctest)
{
}
@@ -25,37 +24,30 @@ bool cmParseMumpsCoverage::ReadCoverageFile(const char* file)
// packages:/full/path/to/Vista/Packages
// coverage_dir:/full/path/to/dir/with/*.mcov
cmsys::ifstream in(file);
- if(!in)
- {
+ if (!in) {
return false;
- }
+ }
std::string line;
- while(cmSystemTools::GetLineFromStream(in, line))
- {
+ while (cmSystemTools::GetLineFromStream(in, line)) {
std::string::size_type pos = line.find(':', 0);
std::string packages;
- if(pos != std::string::npos)
- {
+ if (pos != std::string::npos) {
std::string type = line.substr(0, pos);
- std::string path = line.substr(pos+1);
- if(type == "packages")
- {
+ std::string path = line.substr(pos + 1);
+ if (type == "packages") {
this->LoadPackages(path.c_str());
- }
- else if(type == "coverage_dir")
- {
+ } else if (type == "coverage_dir") {
this->LoadCoverageData(path.c_str());
- }
- else
- {
+ } else {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Parse Error in Mumps coverage file :\n"
- << file <<
- "\ntype: [" << type << "]\npath:[" << path << "]\n"
- "input line: [" << line << "]\n");
- }
+ << file << "\ntype: [" << type << "]\npath:[" << path
+ << "]\n"
+ "input line: ["
+ << line << "]\n");
}
}
+ }
return true;
}
@@ -63,59 +55,50 @@ void cmParseMumpsCoverage::InitializeMumpsFile(std::string& file)
{
// initialize the coverage information for a given mumps file
cmsys::ifstream in(file.c_str());
- if(!in)
- {
+ if (!in) {
return;
- }
+ }
std::string line;
- cmCTestCoverageHandlerContainer::SingleFileCoverageVector&
- coverageVector = this->Coverage.TotalCoverage[file];
- if(!cmSystemTools::GetLineFromStream(in, line))
- {
+ cmCTestCoverageHandlerContainer::SingleFileCoverageVector& coverageVector =
+ this->Coverage.TotalCoverage[file];
+ if (!cmSystemTools::GetLineFromStream(in, line)) {
return;
- }
+ }
// first line of a .m file can never be run
coverageVector.push_back(-1);
- while( cmSystemTools::GetLineFromStream(in, line) )
- {
+ while (cmSystemTools::GetLineFromStream(in, line)) {
// putting in a 0 for a line means it is executable code
// putting in a -1 for a line means it is not executable code
int val = -1; // assume line is not executable
bool found = false;
std::string::size_type i = 0;
// (1) Search for the first whitespace or semicolon character on a line.
- //This will skip over labels if the line starts with one, or will simply
- //be the first character on the line for non-label lines.
- for(; i < line.size(); ++i)
- {
- if(line[i] == ' ' || line[i] == '\t' || line[i] == ';')
- {
+ // This will skip over labels if the line starts with one, or will simply
+ // be the first character on the line for non-label lines.
+ for (; i < line.size(); ++i) {
+ if (line[i] == ' ' || line[i] == '\t' || line[i] == ';') {
found = true;
break;
- }
}
- if(found)
- {
+ }
+ if (found) {
// (2) If the first character found above is whitespace or a period
// then continue the search for the first following non-whitespace
// character.
- if(line[i] == ' ' || line[i] == '\t')
- {
- while(i < line.size() && (line[i] == ' ' || line[i] == '\t'
- || line[i] == '.'))
- {
+ if (line[i] == ' ' || line[i] == '\t') {
+ while (i < line.size() &&
+ (line[i] == ' ' || line[i] == '\t' || line[i] == '.')) {
i++;
- }
}
+ }
// (3) If the character found is not a semicolon then the line counts for
// coverage.
- if(i < line.size() && line[i] != ';')
- {
+ if (i < line.size() && line[i] != ';') {
val = 0;
- }
}
- coverageVector.push_back(val);
}
+ coverageVector.push_back(val);
+ }
}
bool cmParseMumpsCoverage::LoadPackages(const char* d)
@@ -127,15 +110,13 @@ bool cmParseMumpsCoverage::LoadPackages(const char* d)
glob.FindFiles(pat);
std::vector<std::string>& files = glob.GetFiles();
std::vector<std::string>::iterator fileIt;
- for ( fileIt = files.begin(); fileIt != files.end();
- ++ fileIt )
- {
+ for (fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
std::string name = cmSystemTools::GetFilenameName(*fileIt);
- this->RoutineToDirectory[name.substr(0, name.size()-2)] = *fileIt;
+ this->RoutineToDirectory[name.substr(0, name.size() - 2)] = *fileIt;
// initialze each file, this is left out until CDash is fixed
// to handle large numbers of files
this->InitializeMumpsFile(*fileIt);
- }
+ }
return true;
}
@@ -144,25 +125,20 @@ bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine,
{
std::map<std::string, std::string>::iterator i =
this->RoutineToDirectory.find(routine);
- if(i != this->RoutineToDirectory.end())
- {
+ if (i != this->RoutineToDirectory.end()) {
filepath = i->second;
return true;
- }
- else
- {
+ } else {
// try some alternate names
- const char* tryname[] = {"GUX", "GTM", "ONT", 0};
- for(int k=0; tryname[k] != 0; k++)
- {
+ const char* tryname[] = { "GUX", "GTM", "ONT", 0 };
+ for (int k = 0; tryname[k] != 0; k++) {
std::string routine2 = routine + tryname[k];
i = this->RoutineToDirectory.find(routine2);
- if(i != this->RoutineToDirectory.end())
- {
+ if (i != this->RoutineToDirectory.end()) {
filepath = i->second;
return true;
- }
}
}
+ }
return false;
}