This patch lets you create diagnostics that are emitted if and only if a
particular FunctionDecl is codegen'ed.
This is necessary for CUDA, where some constructs -- e.g. calls from
host+device functions to host functions when compiling for device -- are
allowed to appear in semantically-correct programs, but only if they're
never codegen'ed.
Decl memory is pretty precious, I think you'll be better off with a map from Decl* to TinyPtrVector in the ASTContext. Just pass the ASTContext into takeDeferredDiags.