astyle formatting
This commit is contained in:
parent
08ea6435ac
commit
5acd6fcdc8
|
@ -1395,8 +1395,7 @@ void CheckOther::checkConstVariable()
|
||||||
{
|
{
|
||||||
//Is it the right side of an initialization of a non-const reference
|
//Is it the right side of an initialization of a non-const reference
|
||||||
bool usedInAssignment = false;
|
bool usedInAssignment = false;
|
||||||
for (const Token* tok = var->nameToken(); tok != scope->bodyEnd && tok != nullptr; tok = tok->next())
|
for (const Token* tok = var->nameToken(); tok != scope->bodyEnd && tok != nullptr; tok = tok->next()) {
|
||||||
{
|
|
||||||
if (!Token::Match(tok, "& %var% = %varid%", var->declarationId()))
|
if (!Token::Match(tok, "& %var% = %varid%", var->declarationId()))
|
||||||
continue;
|
continue;
|
||||||
const Variable* refvar = tok->next()->variable();
|
const Variable* refvar = tok->next()->variable();
|
||||||
|
@ -1410,12 +1409,10 @@ void CheckOther::checkConstVariable()
|
||||||
}
|
}
|
||||||
// Skip if we ever cast this variable to a pointer/reference to a non-const type
|
// Skip if we ever cast this variable to a pointer/reference to a non-const type
|
||||||
{
|
{
|
||||||
bool castToNonConst = [&]
|
bool castToNonConst = [&] {
|
||||||
{
|
|
||||||
for (const Token* tok = var->nameToken(); tok != scope->bodyEnd && tok != nullptr; tok = tok->next())
|
for (const Token* tok = var->nameToken(); tok != scope->bodyEnd && tok != nullptr; tok = tok->next())
|
||||||
{
|
{
|
||||||
if (tok->isCast())
|
if (tok->isCast()) {
|
||||||
{
|
|
||||||
bool isConst = 0 != (tok->valueType()->constness & (1 << tok->valueType()->pointer));
|
bool isConst = 0 != (tok->valueType()->constness & (1 << tok->valueType()->pointer));
|
||||||
if (!isConst)
|
if (!isConst)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1144,8 +1144,7 @@ private:
|
||||||
void findFunctionInBase(const std::string & name, nonneg int args, std::vector<const Function *> & matches) const;
|
void findFunctionInBase(const std::string & name, nonneg int args, std::vector<const Function *> & matches) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class Reference
|
enum class Reference {
|
||||||
{
|
|
||||||
None,
|
None,
|
||||||
LValue,
|
LValue,
|
||||||
RValue
|
RValue
|
||||||
|
|
|
@ -967,8 +967,7 @@ private:
|
||||||
ASSERT(p->valueType()->pointer == 1);
|
ASSERT(p->valueType()->pointer == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VariableValueTypeReferences()
|
void VariableValueTypeReferences() {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
GET_SYMBOL_DB("void foo(int x) {}\n");
|
GET_SYMBOL_DB("void foo(int x) {}\n");
|
||||||
const Variable* const p = db->getVariableFromVarId(1);
|
const Variable* const p = db->getVariableFromVarId(1);
|
||||||
|
|
Loading…
Reference in New Issue