Type Uniquing with noexcept specifiers


With noexcept, FunctionProtoType gained an Expr* member. This is a problem for uniquing types: to profile an Expr, I need an ASTContext, but I can't get one into FunctionProtoType::Profile(). Other types with an Expr* member (e.g. DependentTypeOfExprType) store their own ASTContext, but I'm loath to store one in a type as common as FunctionProtoType.

Do I have a choice?


In this case, I would add a FunctionProtoWithNoExceptType node that's a "hidden" subclass adding the Expr* and the ASTContext&. We've done this elsewhere, for rarely-used fields of common Type nodes.

  - Doug

Since FunctionProtoType is a variable-length type anyway, I've decided to put the data in there.


To resolve the immediate problem, there's an llvm::ContextualFoldingSet now, so we should really never be doing this ASTContext&-stashing thing anymore.

We can't make subclasses of FunctionProtoType, though, because we store the argument types after the type node. I'd suggest redesigning the existing exception-spec bits, maybe like this:
  /// 0 - no exception spec, NumExceptions is zero
  /// 1 - throw(a,b), NumExceptions is the number of types
  /// 2 - throw(...), NumExceptions is zero
  /// 3 - noexcept, NumExceptions is the number of expressions
  unsigned EHSpecKind : 2;