From 15a847cc0d885011c234a9b032475af15394e27d Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Wed, 18 Mar 2015 10:07:13 +0300 Subject: [PATCH] Move declaration to where it's first needed --- lib/tokenize.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index b81c9a0ed..d61ea782d 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -9228,7 +9228,6 @@ void Tokenizer::simplifyAttribute() } else if (Token::Match(tok->tokAt(2), "( unused|__unused__|used|__used__ )")) { - const std::string &attribute(tok->strAt(3)); Token *vartok = nullptr; // check if after variable name @@ -9242,6 +9241,7 @@ void Tokenizer::simplifyAttribute() vartok = tok->next()->link()->next(); if (vartok) { + const std::string &attribute(tok->strAt(3)); if (attribute.find("unused") != std::string::npos) vartok->isAttributeUnused(true); else @@ -9250,7 +9250,6 @@ void Tokenizer::simplifyAttribute() } else if (Token::Match(tok->tokAt(2), "( pure|__pure__|const|__const__|noreturn|__noreturn__|nothrow|__nothrow__ )")) { - const std::string &attribute(tok->strAt(3)); Token *functok = nullptr; // type func(...) __attribute__((attribute)); @@ -9267,6 +9266,7 @@ void Tokenizer::simplifyAttribute() } if (functok) { + const std::string &attribute(tok->strAt(3)); if (attribute.find("pure") != std::string::npos) functok->isAttributePure(true); else if (attribute.find("const") != std::string::npos)