bwendling wrote:

> I mean, the base case should be "return nullptr", and you should only 
> explicitly list out expressions you know we need to handle. We shouldn't need 
> to explicitly mention VisitUnaryPostDec etc.

The expression can be arbitrarily complex. For instance this:

```
struct s {
  struct s *p;
  int count;
  int array[] __attribute__((count));
};

int foo(struct s *p, int index) {
  return p->p->p->array[index];
}

struct q {
  struct s *ptr[20];
};

int bar(struct q *f, int idx1, int index) {
  return f->ptr[idx1]->p->array[index];
}
```

and so on. If all I was dealing with were 
`ArraySubscriptExpr(MemberExpr(DeclRefExpr), ArrayIndex)`, I wouldn't have to 
jump through hoops to deal with these horrors.

In `ArraySubscriptExpr`, I don't even have the luxury of knowing what all of 
the elements in the expression are, since it could be on an arbitrary recursive 
level.

https://github.com/llvm/llvm-project/pull/73730
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to