Optimize for the cases where the pointer value is known at compile-time.

This commit is contained in:
Baozeng Ding 2013-08-16 20:00:01 +02:00 committed by sftnight
parent eca58d0ffc
commit 2152ad4c7d

View File

@ -88,8 +88,21 @@ namespace cling {
// Store all the null attr argument's index into "ArgIndexs".
for (NonNullAttr::args_iterator i = NonNull->args_begin(),
e = NonNull->args_end(); i != e; ++i)
e = NonNull->args_end(); i != e; ++i) {
// Get the argument with the nonnull attribute.
const Expr* Arg = TheCall->getArg(*i);
// Check whether we can get the argument'value. If the argument is
// not null, then ignore this argument and continue to deal with the
// next argument with the nonnull attribute.ArgIndexs.set(*i);
bool Result;
ASTContext& Context = m_Sema->getASTContext();
if (Arg->EvaluateAsBooleanCondition(Result, Context) && Result) {
continue;
}
ArgIndexs.set(*i);
}
}
if (ArgIndexs.any()) {