Iterate over the redecl chain to find the non null attribute.
This commit is contained in:
parent
9daf1d7571
commit
3f256225e9
@ -117,27 +117,31 @@ namespace cling {
|
||||
bool VisitCallExpr(CallExpr* TheCall) {
|
||||
if (FunctionDecl* FDecl = TheCall->getDirectCallee()) {
|
||||
std::bitset<32> ArgIndexs;
|
||||
for (specific_attr_iterator<NonNullAttr>
|
||||
I = FDecl->specific_attr_begin<NonNullAttr>(),
|
||||
E = FDecl->specific_attr_end<NonNullAttr>(); I != E; ++I) {
|
||||
NonNullAttr *NonNull = *I;
|
||||
for (FunctionDecl::redecl_iterator RI = FDecl->redecls_begin(),
|
||||
RE = FDecl->redecls_end(); RI != RE; ++RI) {
|
||||
for (specific_attr_iterator<NonNullAttr>
|
||||
I = RI->specific_attr_begin<NonNullAttr>(),
|
||||
E = RI->specific_attr_end<NonNullAttr>(); I != E; ++I) {
|
||||
NonNullAttr *NonNull = *I;
|
||||
|
||||
// Store all the null attr argument's index into "ArgIndexs".
|
||||
for (NonNullAttr::args_iterator i = NonNull->args_begin(),
|
||||
// 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) {
|
||||
|
||||
// Get the argument with the nonnull attribute.
|
||||
const Expr* Arg = TheCall->getArg(*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;
|
||||
// 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);
|
||||
}
|
||||
ArgIndexs.set(*i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user