forked from qt-creator/qt-creator
ClassView: Optimize operator== of internal data
Make all of the fields of SymbolLocation and SymbolInformation const members. Optimize a bit operator== of these structures: check first if hashes are non-equal - in this case return false early. Fix hash type of SymbolInformation for porting to Qt6 purpose. Task-number: QTCREATORBUG-25317 Task-number: QTCREATORBUG-24098 Change-Id: I769f99ff3157093e9f10ee3929bc7f6eb83f34e3 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -45,20 +45,16 @@ SymbolLocation::SymbolLocation() :
|
||||
{
|
||||
}
|
||||
|
||||
SymbolLocation::SymbolLocation(QString file, int lineNumber, int columnNumber) :
|
||||
m_fileName(file),
|
||||
m_line(lineNumber),
|
||||
m_column(columnNumber)
|
||||
{
|
||||
if (m_column < 0)
|
||||
m_column = 0;
|
||||
|
||||
// pre-computate hash value
|
||||
SymbolLocation::SymbolLocation(const QString &file, int lineNumber, int columnNumber)
|
||||
: m_fileName(file)
|
||||
, m_line(lineNumber)
|
||||
, m_column(qMax(columnNumber, 0))
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
m_hash = qHashMulti(0, m_fileName, m_line, m_column);
|
||||
, m_hash(qHashMulti(0, m_fileName, m_line, m_column))
|
||||
#else
|
||||
m_hash = qHash(qMakePair(m_fileName, qMakePair(m_line, m_column)));
|
||||
, m_hash(qHash(qMakePair(m_fileName, qMakePair(m_line, m_column))))
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user