reduce: reduce structs/enums/etc better

This commit is contained in:
Daniel Marjamäki 2013-01-20 09:05:50 +01:00
parent 67c9720299
commit 89b54cb2c9
1 changed files with 21 additions and 12 deletions

View File

@ -262,6 +262,14 @@ static bool removeBlocksOfCode(const ReduceSettings &settings, std::vector<std::
// does code block start with "{"
std::size_t pos2 = pos;
// struct X { ..
if (filedata[pos].find_first_of("();}") == std::string::npos && filedata[pos].at(filedata[pos].size()-1U) == '{') {
}
// function declaration ..
else {
if (filedata[pos].find("(") != std::string::npos && filedata[pos].find(")")==std::string::npos) {
++pos2;
while (pos2+2U < filedata.size() && !filedata[pos2].empty() && filedata[pos2].find_first_of("(){}") == std::string::npos)
@ -277,6 +285,7 @@ static bool removeBlocksOfCode(const ReduceSettings &settings, std::vector<std::
}
if (pos2+2U >= filedata.size() || filedata[pos2] != "{")
break;
}
pos2++;
// find end of block..