Remove clang AST nodes attached to CIR operations

Some CIR operations have references back to Clang AST, this is necessary to perform lots of useful checks without having to duplicate all rich AST information in CIR. As we move down in the pipeline (e.g. generating LLVM or other MLIR dialects), the need for such nodes diminish and AST information can be dropped.

Right now this is enabled by default in Clang prior to dialect codegen from CIR, but not before lifetime check, where AST is required to be present.


Check lifetime safety and generate diagnostics

This pass relies on a lifetime analysis pass and uses the diagnostics mechanism to report to the user. It does not change any code.

A default ctor is specified but is solely in order to make tablegen happy, since this pass requires the presence of an ASTContext, one can set that up using mlir::createLifetimeCheckPass(clang::ASTContext &) instead.


-history       : List of history styles to emit as part of diagnostics. Supported styles: {all|null|invalid}
-remarks       : List of remark styles to enable as part of diagnostics. Supported styles: {all|pset}
-history_limit : Max amount of diagnostics to emit on pointer history


Remove unnecessary branches to cleanup blocks

Canonicalize pass is too aggressive for CIR when the pipeline is used for C/C++ analysis. This pass runs some rewrites for scopes, merging some blocks and eliminating unnecessary control-flow.