Support :: prefix in front of allocation function.

This commit is contained in:
PKEuS 2014-10-01 10:59:08 +02:00
parent 14f15d65e7
commit 7c7fcf36af
2 changed files with 3 additions and 0 deletions

View File

@ -125,6 +125,8 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getAllocationType(const Token *tok2,
}
if (! tok2)
return No;
if (tok2->str() == "::")
tok2 = tok2->next();
if (! tok2->isName())
return No;

View File

@ -408,6 +408,7 @@ private:
void testgetcode() {
// alloc;
ASSERT_EQUALS(";;alloc;", getcode("int *a = malloc(100);", "a"));
TODO_ASSERT_EQUALS(";;alloc;", ";;alloccallfunc;", getcode("int *a = ::malloc(100);", "a"));
ASSERT_EQUALS(";;alloc;", getcode("int *a = new int;", "a"));
ASSERT_EQUALS(";;alloc;", getcode("int *a = new int[10];", "a"));
ASSERT_EQUALS(";;alloc;", getcode("int **a = new int*[10];", "a"));