[analyzer] Malloc checker: remove unnecessary comparisons.

llvm-svn: 157081
This commit is contained in:
Anna Zaks 2012-05-18 22:47:40 +00:00
parent 14862c3141
commit b343660914
1 changed files with 10 additions and 16 deletions

View File

@ -339,22 +339,16 @@ public:
} // end anonymous namespace } // end anonymous namespace
void MallocChecker::initIdentifierInfo(ASTContext &Ctx) const { void MallocChecker::initIdentifierInfo(ASTContext &Ctx) const {
if (!II_malloc) if (II_malloc)
II_malloc = &Ctx.Idents.get("malloc"); return;
if (!II_free) II_malloc = &Ctx.Idents.get("malloc");
II_free = &Ctx.Idents.get("free"); II_free = &Ctx.Idents.get("free");
if (!II_realloc) II_realloc = &Ctx.Idents.get("realloc");
II_realloc = &Ctx.Idents.get("realloc"); II_reallocf = &Ctx.Idents.get("reallocf");
if (!II_reallocf) II_calloc = &Ctx.Idents.get("calloc");
II_reallocf = &Ctx.Idents.get("reallocf"); II_valloc = &Ctx.Idents.get("valloc");
if (!II_calloc) II_strdup = &Ctx.Idents.get("strdup");
II_calloc = &Ctx.Idents.get("calloc"); II_strndup = &Ctx.Idents.get("strndup");
if (!II_valloc)
II_valloc = &Ctx.Idents.get("valloc");
if (!II_strdup)
II_strdup = &Ctx.Idents.get("strdup");
if (!II_strndup)
II_strndup = &Ctx.Idents.get("strndup");
} }
bool MallocChecker::isMemFunction(const FunctionDecl *FD, ASTContext &C) const { bool MallocChecker::isMemFunction(const FunctionDecl *FD, ASTContext &C) const {