Fixed another crash in clang test suite and let two times two functions in std.cfg share same configuration

This commit is contained in:
PKEuS 2015-11-15 14:55:10 +01:00
parent 4e578af603
commit 25749ab19f
3 changed files with 16 additions and 34 deletions

View File

@ -3891,20 +3891,8 @@
</arg>
</function>
<!-- size_t c16rtomb ( char * pmb, char16_t c16, mbstate_t * ps ); -->
<function name="c16rtomb">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"/>
<arg nr="2">
<not-uninit/>
</arg>
<arg nr="3">
<not-null/>
<not-uninit/>
</arg>
</function>
<!-- size_t c32rtomb ( char * pmb, char32_t c32, mbstate_t * ps ); -->
<function name="c32rtomb">
<function name="c16rtomb,c32rtomb">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"/>
@ -3917,23 +3905,8 @@
</arg>
</function>
<!-- size_t mbrtoc16 ( char16_t * pc16, const char * pmb, size_t max, mbstate_t * ps); -->
<function name="mbrtoc16">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"/>
<arg nr="2">
<not-uninit/>
</arg>
<arg nr="3">
<not-uninit/>
</arg>
<arg nr="4">
<not-null/>
<not-uninit/>
</arg>
</function>
<!-- size_t mbrtoc32 ( char32_t * pc32, const char * pmb, size_t max, mbstate_t * ps); -->
<function name="mbrtoc32">
<function name="mbrtoc16,mbrtoc32">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"/>

View File

@ -450,21 +450,19 @@ void CheckStl::pushback()
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
if (Token::Match(tok, "%var% = & %var% [")) {
// Skip it directly if it is a pointer or an array
if (tok->tokAt(3)->variable()->isArrayOrPointer())
const Token* containerTok = tok->tokAt(3);
if (containerTok->variable() && containerTok->variable()->isArrayOrPointer())
continue;
// Variable id for pointer
const unsigned int pointerId(tok->varId());
// Variable id for the container variable
const unsigned int containerId(tok->tokAt(3)->varId());
bool invalidPointer = false;
const Token* function = nullptr;
const Token* end2 = tok->scope()->classEnd;
for (const Token *tok2 = tok; tok2 != end2; tok2 = tok2->next()) {
// push_back on vector..
if (Token::Match(tok2, "%varid% . push_front|push_back|insert|reserve|resize|clear", containerId)) {
if (Token::Match(tok2, "%varid% . push_front|push_back|insert|reserve|resize|clear", containerTok->varId())) {
invalidPointer = true;
function = tok2->tokAt(2);
}

View File

@ -89,6 +89,7 @@ private:
TEST_CASE(pushback10);
TEST_CASE(pushback11);
TEST_CASE(pushback12);
TEST_CASE(pushback13);
TEST_CASE(insert1);
TEST_CASE(insert2);
@ -1298,6 +1299,16 @@ private:
"[test.cpp:9]: (error) After insert(), the iterator 'it' may be invalid.\n", errout.str());
}
void pushback13() {
check("bool Preprocessor::ConcatenateIncludeName(SmallString<128> &FilenameBuffer, SourceLocation &End) {\n"
" unsigned PreAppendSize = FilenameBuffer.size();\n"
" FilenameBuffer.resize(PreAppendSize + CurTok.getLength());\n"
" const char *BufPtr = &FilenameBuffer[PreAppendSize];\n"
" return true;\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void insert1() {
check("void f(std::vector<int> &ints)\n"
"{\n"