parent
966a89d5f4
commit
83ac6bfa0f
|
@ -2887,7 +2887,8 @@ void CheckOther::checkRedundantCopy()
|
|||
if (fScope && fScope->bodyEnd && Token::Match(fScope->bodyEnd->tokAt(-3), "return %var% ;")) {
|
||||
const Token* varTok = fScope->bodyEnd->tokAt(-2);
|
||||
if (varTok->variable() && !varTok->variable()->isGlobal() &&
|
||||
(!varTok->variable()->type() || estimateSize(varTok->variable()->type(), mSettings, symbolDatabase) > 2 * mSettings->platform.sizeof_pointer))
|
||||
(!varTok->variable()->type() || !varTok->variable()->type()->classScope ||
|
||||
estimateSize(varTok->variable()->type(), mSettings, symbolDatabase) > 2 * mSettings->platform.sizeof_pointer))
|
||||
redundantCopyError(startTok, startTok->str());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -580,3 +580,16 @@ namespace {
|
|||
Q_PROPERTY(QHash<QString, int> hash READ hash WRITE setHash)
|
||||
};
|
||||
}
|
||||
|
||||
struct SEstimateSize {
|
||||
inline const QString& get() const { return m; }
|
||||
QString m;
|
||||
};
|
||||
|
||||
class QString;
|
||||
|
||||
void dontCrashEstimateSize(const SEstimateSize& s) {
|
||||
// cppcheck-suppress redundantCopyLocalConst
|
||||
QString q = s.get();
|
||||
if (!q.isNull()) {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue