rdwampler added inline comments.

================
Comment at: tools/libclang/CIndex.cpp:7322
+
+  for (int I = 0, E = AvailabilityAttrs.size(); I < E && I < availability_size;
+       ++I) {
----------------
arphaman wrote:
> You can use a ranged for loop here if you use `take_front`, e.g.
> 
> ```
> for (const auto *Avail : AvailabilityAttrs.take_front(availability_size))
> ```
I would need to covert this to an `ArrayRef`, I believe. Also, I would need to 
check `availability_size` is in bounds. Would something like the following be 
preferred:
```
int N = 0;
for (const auto *Avail : AvailabilityAttrs) {
  if (N < availability_size) {
    // populate availability
    N++;
  }
}
```


https://reviews.llvm.org/D33478



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to