[LLVMdev] PostOrderIterator

Speziale Ettore speziale.ettore at gmail.com
Sun Mar 24 13:15:58 PDT 2013


Hello,

I was playing with PostOrderIterator.h and I found a strange behavior.

The core class, po_iterator, is a template. One of its template
parameters is the type of the set used to store visited nodes. An
instance of that type is used by its superclass, po_iterator_storage.

Default value of the set type is llvm::SmallPtrSet. This is correct,
since po_iterator_storage::insertEdge expects that the set type provides
an insert methods which returns a boolean value.

Later three classes are derived from po_iterator -- po_ext_iterator,
ipo_iterator, and ipo_ext_iterator -- however for these classes the
default set type is std::set! This kind of set cannot be used with
po_iterator because its insert method returns a std::pair, not a
boolean.

Thus, is a bug or a feature having std::set as default value of the
template parameter?

Bye,
speziale.ettore at gmail.com




More information about the llvm-dev mailing list