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

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Tue May 14 00:16:05 PDT 2024


================
@@ -2900,7 +2900,7 @@ defm clangir : BoolFOption<"clangir",
   PosFlag<SetTrue, [], [ClangOption, CC1Option], "Use the ClangIR pipeline to compile">,
   NegFlag<SetFalse, [], [ClangOption, CC1Option], "Use the AST -> LLVM pipeline to compile">,
   BothFlags<[], [ClangOption, CC1Option], "">>;
-def emit_cir : Flag<["-"], "emit-cir">, Visibility<[CC1Option]>,
+def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
----------------
MaskRay wrote:

> Notably, -emit-llvm-bc does the wrong thing in all cases. clang -Xclang -emit-llvm-bc hello.c does the wrong thing and emits an executable. clang -Xclang -emit-llvm -S hello.c also does the wrong thing and emits a file named hello.s that is actually llvm bitcode.

The description of #91140 might be useful.

You need `-S` or `-c` to disable linking. Then `-c -Xclang -emit-cir` can be used to override the assumed action passed by clangDriver to cc1.

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


More information about the cfe-commits mailing list