Conventions for AST helper functions

While working on the string interpolation implementation, I realized that, at least preliminarily, I would need to synthesize IntegerLiteralExprs and add them to the AST. This is slightly non-trivial because IntegerLiteralExpr stores integer literals in the form of a string.

I poked around a little bit and found some code to convert an integer to an IntegerLiteralExpr in swiftSema's Equatable/Hashable auto-derivation code, so at least temporarily in this branch, I've moved it into a static method in swiftAST. But I'm not sure if we prefer to handle this sort of situation like this, so I have a couple of questions:

  1. When we discover an AST-synthesis operation like this which we need to perform in several places, but which is a little more involved than just a plain constructor, where should we put it? Directly on the type it's constructing? Somewhere else in swiftAST? In some dedicated place? Should we create a new home for them?

  2. Should we proactively try to build up helpers like these in some central place?

  3. In this specific case, I ended up with the method IntegerLiteralExpr * IntegerLiteralExpr::createImplicitFromInt(ASTContext &, int64_t). Is this a good name for it? Should I just call it createImplicit and assume people will figure out what it does from the type it's passed?

I'm not waiting for any of these answers before I continue work, but I'd like to know what I should be doing.

Thanks!