Fixed false positive in self check

This commit is contained in:
Daniel Marjamäki 2021-03-20 18:53:17 +01:00
parent b0ac92ce8f
commit b2691bda88
2 changed files with 8 additions and 0 deletions

View File

@ -2844,6 +2844,9 @@ Check::FileInfo *CheckClass::getFileInfo(const Tokenizer *tokenizer, const Setti
// One definition rule
std::vector<MyFileInfo::NameLoc> classDefinitions;
for (const Scope * classScope : tokenizer->getSymbolDatabase()->classAndStructScopes) {
if (classScope->isAnonymous())
continue;
// the full definition must be compared
bool fullDefinition = std::all_of(classScope->functionList.begin(),
classScope->functionList.end(),

View File

@ -1029,6 +1029,11 @@ public:
std::vector<Enumerator> enumeratorList;
bool isAnonymous() const {
// TODO: Check if class/struct is anonymous
return className.size() > 9 && className.compare(0,9,"Anonymous") == 0 && std::isdigit(className[9]);
}
const Enumerator * findEnumerator(const std::string & name) const {
for (const Enumerator & i : enumeratorList) {
if (i.name->str() == name)