| Summary: | Range-based for loop should be treated as referencing the relevant begin/end functions | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Nathan Ridge <zeratul976> |
| Component: | cdt-indexer | Assignee: | Markus Schorn <mschorn.eclipse> |
| Status: | RESOLVED FIXED | QA Contact: | Markus Schorn <mschorn.eclipse> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug |
| Version: | 8.1.0 | ||
| Target Milestone: | 8.1.0 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
I have added implicit names for 'begin' and 'end' to the range based for loop. With that the references are written to the index. |
In the following code: struct intarr { int* first; int size; }; int* begin(const intarr& a) { return a.first; } // "find references" for this... int* end(const intarr& a) { return a.first + a.size; } int main() { intarr a; for (int i : a) // ... does not find this ; } If I do a "find references" on the "begin" or "end" function, the for loop is not found as a reference, even though it implicitly calls both. Range-based for loops for non-array types always call some begin() and end() functions, and they should be treated as referencing these functions.