One definition rule; avoid false positives when location is same
This commit is contained in:
parent
fbf63b932e
commit
c2c40a18fd
|
@ -2952,6 +2952,9 @@ bool CheckClass::analyseWholeProgram(const CTU::FileInfo *ctu, const std::list<C
|
|||
}
|
||||
if (it->second.hash == nameLoc.hash)
|
||||
continue;
|
||||
// Same location, sometimes the hash is different wrongly (possibly because of different token simplifications).
|
||||
if (it->second.isSameLocation(nameLoc))
|
||||
continue;
|
||||
|
||||
std::list<ErrorMessage::FileLocation> locationList;
|
||||
locationList.emplace_back(nameLoc.fileName, nameLoc.lineNumber, nameLoc.column);
|
||||
|
|
|
@ -161,10 +161,13 @@ public:
|
|||
std::size_t hash;
|
||||
|
||||
bool operator==(const NameLoc& other) const {
|
||||
return isSameLocation(other) && hash == other.hash;
|
||||
}
|
||||
|
||||
bool isSameLocation(const NameLoc& other) const {
|
||||
return fileName == other.fileName &&
|
||||
lineNumber == other.lineNumber &&
|
||||
column == other.column &&
|
||||
hash == other.hash;
|
||||
column == other.column;
|
||||
}
|
||||
};
|
||||
std::vector<NameLoc> classDefinitions;
|
||||
|
|
Loading…
Reference in New Issue