This commit is contained in:
parent
e2f38fdaf3
commit
980c92d19d
|
@ -5552,7 +5552,10 @@ void Tokenizer::removeMacrosInGlobalScope()
|
|||
if (tok->str() == "(") {
|
||||
tok = tok->link();
|
||||
if (Token::Match(tok, ") %type% {") &&
|
||||
!Token::Match(tok->next(), "const|namespace|class|struct|union|noexcept|override|final|volatile|mutable"))
|
||||
!tok->next()->isStandardType() &&
|
||||
!tok->next()->isKeyword() &&
|
||||
!Token::Match(tok->next(), "override|final") &&
|
||||
tok->next()->isUpperCaseName())
|
||||
tok->deleteNext();
|
||||
}
|
||||
|
||||
|
|
|
@ -561,7 +561,7 @@ static bool iscpp11init_impl(const Token * const tok)
|
|||
nameToken = nameToken->link()->previous();
|
||||
if (nameToken->str() == "]") {
|
||||
const Token* newTok = nameToken->link()->previous();
|
||||
while (Token::Match(newTok, "%type%") && !newTok->isKeyword())
|
||||
while (Token::Match(newTok, "%type%|::") && !newTok->isKeyword())
|
||||
newTok = newTok->previous();
|
||||
if (Token::simpleMatch(newTok, "new"))
|
||||
return true;
|
||||
|
|
|
@ -5256,6 +5256,15 @@ private:
|
|||
"\n"
|
||||
"BOOL CSetProgsAdvDlg::OnInitDialog() {}"),
|
||||
InternalError);
|
||||
|
||||
ASSERT_EQUALS("struct S {\n"
|
||||
"S ( ) : p { new ( malloc ( 4 ) ) int { } } { }\n"
|
||||
"int * p ;\n"
|
||||
"} ;",
|
||||
tokenizeAndStringify("struct S {\n"
|
||||
" S() : p{new (malloc(4)) int{}} {}\n"
|
||||
" int* p;\n"
|
||||
"};\n"));
|
||||
}
|
||||
|
||||
void addSemicolonAfterUnknownMacro() {
|
||||
|
@ -7563,6 +7572,20 @@ private:
|
|||
"{ void",
|
||||
TokenImpl::Cpp11init::NOINIT);
|
||||
|
||||
testIsCpp11init("struct S {\n"
|
||||
" std::uint8_t* p;\n"
|
||||
" S() : p{ new std::uint8_t[1]{} } {}\n"
|
||||
"};\n",
|
||||
"{ } } {",
|
||||
TokenImpl::Cpp11init::CPP11INIT);
|
||||
|
||||
testIsCpp11init("struct S {\n"
|
||||
" S() : p{new (malloc(4)) int{}} {}\n"
|
||||
" int* p;\n"
|
||||
"};\n",
|
||||
"{ } } {",
|
||||
TokenImpl::Cpp11init::CPP11INIT);
|
||||
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("template<typename U> struct X {};\n" // don't crash
|
||||
"template<typename T> auto f(T t) -> X<decltype(t + 1)> {}\n"));
|
||||
#undef testIsCpp11init
|
||||
|
|
Loading…
Reference in New Issue