Rafael Espíndola
2013-Aug-02 20:56 UTC
[LLVMdev] Coding Standards: Iterator begin and end functions.
One exception we have in the coding standard is that classes that look like STL ones should use similar names for the methods (begin(), push_back(), etc...). But different parts of llvm have different opinions on how to handle the related case of classes that are not STL like, but have multiple collections that can be iterated over. * llvm/IR uses global_begin, alias_begin, etc. I.E., singular name + _begin(). * llvm/Object uses begin_symbols, begin_sections, etc. I.E, begin_ + plural name. * others (YAML, LoopIterator) use beginSequence, beginFlowSequence, etc. I would like to propose adding the the format used by llvm/IR to the coding standard since it seems to be the most common. Cheers, Rafael
David Blaikie
2013-Aug-02 21:02 UTC
[LLVMdev] Coding Standards: Iterator begin and end functions.
SGTM. On Fri, Aug 2, 2013 at 1:56 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:> One exception we have in the coding standard is that classes that look > like STL ones should use similar names for the methods (begin(), > push_back(), etc...). > > But different parts of llvm have different opinions on how to handle > the related case of classes that are not STL like, but have multiple > collections that can be iterated over. > > * llvm/IR uses global_begin, alias_begin, etc. I.E., singular name + _begin(). > * llvm/Object uses begin_symbols, begin_sections, etc. I.E, begin_ + > plural name. > * others (YAML, LoopIterator) use beginSequence, beginFlowSequence, etc. > > I would like to propose adding the the format used by llvm/IR to the > coding standard since it seems to be the most common. > > Cheers, > Rafael > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Chandler Carruth
2013-Aug-02 21:07 UTC
[LLVMdev] Coding Standards: Iterator begin and end functions.
On Fri, Aug 2, 2013 at 1:56 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:> One exception we have in the coding standard is that classes that look > like STL ones should use similar names for the methods (begin(), > push_back(), etc...). > > But different parts of llvm have different opinions on how to handle > the related case of classes that are not STL like, but have multiple > collections that can be iterated over. > > * llvm/IR uses global_begin, alias_begin, etc. I.E., singular name + > _begin(). > * llvm/Object uses begin_symbols, begin_sections, etc. I.E, begin_ + > plural name. > * others (YAML, LoopIterator) use beginSequence, beginFlowSequence, etc. > > I would like to propose adding the the format used by llvm/IR to the > coding standard since it seems to be the most common. >Please do so. That is clearly the more consistent pattern to follow. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130802/77c94b9e/attachment.html>
Jim Grosbach
2013-Aug-02 21:43 UTC
[LLVMdev] Coding Standards: Iterator begin and end functions.
On Aug 2, 2013, at 2:07 PM, Chandler Carruth <chandlerc at google.com> wrote:> > On Fri, Aug 2, 2013 at 1:56 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote: > One exception we have in the coding standard is that classes that look > like STL ones should use similar names for the methods (begin(), > push_back(), etc...). > > But different parts of llvm have different opinions on how to handle > the related case of classes that are not STL like, but have multiple > collections that can be iterated over. > > * llvm/IR uses global_begin, alias_begin, etc. I.E., singular name + _begin(). > * llvm/Object uses begin_symbols, begin_sections, etc. I.E, begin_ + > plural name. > * others (YAML, LoopIterator) use beginSequence, beginFlowSequence, etc. > > I would like to propose adding the the format used by llvm/IR to the > coding standard since it seems to be the most common. > > Please do so. That is clearly the more consistent pattern to follow.+1. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130802/3ccfeefa/attachment.html>
Chris Lattner
2013-Aug-02 22:00 UTC
[LLVMdev] Coding Standards: Iterator begin and end functions.
On Aug 2, 2013, at 1:56 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:> One exception we have in the coding standard is that classes that look > like STL ones should use similar names for the methods (begin(), > push_back(), etc...). > > But different parts of llvm have different opinions on how to handle > the related case of classes that are not STL like, but have multiple > collections that can be iterated over. > > * llvm/IR uses global_begin, alias_begin, etc. I.E., singular name + _begin(). > * llvm/Object uses begin_symbols, begin_sections, etc. I.E, begin_ + > plural name. > * others (YAML, LoopIterator) use beginSequence, beginFlowSequence, etc. > > I would like to propose adding the the format used by llvm/IR to the > coding standard since it seems to be the most common.+1 -Chris
Possibly Parallel Threads
- [LLVMdev] Coding Standards: Iterator begin and end functions.
- [LLVMdev] Coding Standards: Iterator begin and end functions.
- [LLVMdev] Removing AvailableExternal values in GlobalDCE (was Re: RFC: ThinLTO Impementation Plan)
- [LLVMdev] Questions about llvm/Object/COFF.h
- [LLVMdev] Questions about llvm/Object/COFF.h