Sort headers/global definitions to enable reproducible code generation
Compare changes
+ 2
− 2
@@ -87,7 +87,7 @@ def get_global_declarations(ast):
@@ -103,7 +103,7 @@ def get_headers(ast_node: Node) -> Set[str]:
headers and global_declarations are generated by methods that return sets. So even with the same inputs it is not guaranteed that the same source code is generated since sets do not guarantee a specific order when iterating over them.
I was supprised that my generated code could often not be reused from the cache. The problem was that the included headers appeared in random order.