Skip to content

Commit 6f36218

Browse files
committed
fixes
1 parent 10929b7 commit 6f36218

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

lib/checkclass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ void CheckClass::copyconstructors()
437437
}
438438
} else if (func.type == FunctionType::eDestructor && func.functionScope) {
439439
// Deallocations in destructors
440-
const Token* tok = func.token->linkAt(1);
440+
const Token* tok = func.functionScope->bodyStart;
441441
for (const Token* const end = func.functionScope->bodyEnd; tok != end; tok = tok->next()) {
442442
if (Token::Match(tok, "delete %var%") ||
443443
(Token::Match(tok, "%name% ( %var%") && mSettings->library.getDeallocFuncInfo(tok))) {
@@ -450,8 +450,8 @@ void CheckClass::copyconstructors()
450450
}
451451
}
452452

453-
bool hasAllocatedVars = !allocatedVars.empty();
454-
bool hasDeallocatedVars = !deallocatedVars.empty();
453+
const bool hasAllocatedVars = !allocatedVars.empty();
454+
const bool hasDeallocatedVars = !deallocatedVars.empty();
455455

456456
if (hasAllocatedVars || hasDeallocatedVars) {
457457
const Function *funcCopyCtor = nullptr;

lib/token.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,8 +2632,6 @@ const ValueFlow::Value* Token::getContainerSizeValue(const MathLib::bigint val)
26322632

26332633
TokenImpl::~TokenImpl()
26342634
{
2635-
// cppcheck-suppress-begin [noCopyConstructor, noOperatorEq]
2636-
26372635
delete mMacroName;
26382636
delete mOriginalName;
26392637
delete mValueType;
@@ -2651,8 +2649,6 @@ TokenImpl::~TokenImpl()
26512649
mCppcheckAttributes = mCppcheckAttributes->next;
26522650
delete c;
26532651
}
2654-
2655-
// cppcheck-suppress-end [noCopyConstructor, noOperatorEq]
26562652
}
26572653

26582654
void TokenImpl::setCppcheckAttribute(TokenImpl::CppcheckAttributes::Type type, MathLib::bigint value)

lib/token.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ struct TokenImpl {
147147
TokenImpl() : mFunction(nullptr) {}
148148

149149
~TokenImpl();
150+
151+
TokenImpl(const TokenImpl &) = delete;
152+
TokenImpl operator=(const TokenImpl &) = delete;
150153
};
151154

152155
/// @addtogroup Core

0 commit comments

Comments
 (0)