Fixed crash in clang test suite.

This commit is contained in:
PKEuS 2015-11-15 14:40:31 +01:00
parent 3f255e7685
commit 481d800d5a
2 changed files with 11 additions and 0 deletions

View File

@ -78,6 +78,9 @@ void CheckStl::iterators()
if (var->typeEndToken()->str() == "auto") { if (var->typeEndToken()->str() == "auto") {
if (Token::Match(var->typeEndToken(), "auto %name% ; %name% = %var% . %name% ( )")) { if (Token::Match(var->typeEndToken(), "auto %name% ; %name% = %var% . %name% ( )")) {
const Token* containertok = var->typeEndToken()->tokAt(5); const Token* containertok = var->typeEndToken()->tokAt(5);
if (!containertok->variable())
continue;
const Library::Container* container = _settings->library.detectContainer(containertok->variable()->typeStartToken()); const Library::Container* container = _settings->library.detectContainer(containertok->variable()->typeStartToken());
if (!container) if (!container)
continue; continue;

View File

@ -535,6 +535,14 @@ private:
" auto b = x.first;\n" " auto b = x.first;\n"
"}"); "}");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
check("const CXXRecordDecl *CXXRecordDecl::getTemplateInstantiationPattern() const {\n"
" if (auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(this)) {\n"
" auto From = TD->getInstantiatedFrom();\n"
" }\n"
" return nullptr;\n"
"}");
ASSERT_EQUALS("", errout.str());
} }
void STLSize() { void STLSize() {