[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

David Olsen via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 10:08:58 PST 2024


================
@@ -52,10 +62,33 @@ class CIRGenModule : public CIRGenTypeCache {
   /// A "module" matches a c/cpp source file: containing a list of functions.
   mlir::ModuleOp theModule;
 
+  clang::DiagnosticsEngine &diags;
+
   const clang::TargetInfo ⌖
 
 public:
+  mlir::ModuleOp getModule() const { return theModule; }
+
+  /// Helpers to convert Clang's SourceLocation to an MLIR Location.
----------------
dkolsen-pgi wrote:

I ran some tests.  ClangIR (both the incubator and this PR) uses the presumed location from the `SourceLocation` when creating an `mlir::Location`.  It honors `#line` directives and records the location where the macro was expanded.  That is the location we most want to keep around.

I changed the comment to say that the presumed location is what is converted.


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


More information about the cfe-commits mailing list