[clang] [CIR] Build out AST consumer patterns to reach the entry point into CIRGen (PR #91007)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue May 14 04:59:02 PDT 2024


================
@@ -42,6 +47,14 @@ CreateFrontendBaseAction(CompilerInstance &CI) {
   StringRef Action("unknown");
   (void)Action;
 
+  auto UseCIR = CI.getFrontendOpts().UseClangIRPipeline;
----------------
AaronBallman wrote:

> Nit: technically the coding standard does not say that, I believe you're mentioning a sufficient condition, not a necessary one, see https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable
> 
> > Use auto if and only if it makes the code more readable or easier to maintain.

Yup. FWIW, the rule of thumb we use in Clang is that "readable" means "type is spelled out in the initialization somewhere or is otherwise painful to spell but is contextually quite obvious (e.g., use of iterators)" + "any time the code reviewer asks to switch away from `auto`"

https://github.com/llvm/llvm-project/pull/91007


More information about the cfe-commits mailing list