Inferno  0.2
sort_decls.hpp
Go to the documentation of this file.
00001 #ifndef SORT_DECLS_HPP
00002 #define SORT_DECLS_HPP
00003 
00004 #include "common/common.hpp"
00005 #include "tree/cpptree.hpp"
00006 #include "helpers/walk.hpp"
00007 
00008 // Does declaration of a depend on (ie use) declaration of b?
00009 // Set ignore_ptr_ref_record to make function ignore the case where a's type contains a pointer or 
00010 // reference to b
00011 bool IsDependOn( TreePtr<CPPTree::Declaration> a, TreePtr<CPPTree::Declaration> b, bool ignore_indirection_to_record=false );
00012 
00013 // Sort some declarations into an order that will compile successfully.
00014 // Optionally ignore pointers and references to records: they can be cyclic and so cannot be sorted
00015 // on. Set to "true" if incomplete declarations for all records have already been emitted. 
00016 Sequence<CPPTree::Declaration> SortDecls( ContainerInterface &c, bool ignore_indirection_to_record );
00017 
00018 // Mix them up randomly!!
00019 Sequence<CPPTree::Declaration> JumbleDecls( Sequence<CPPTree::Declaration> c );
00020 Sequence<CPPTree::Declaration> ReverseDecls( Sequence<CPPTree::Declaration> c );
00021 
00022 #endif