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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 31 13:11:09 PDT 2024


erichkeane wrote:

> > Does https://mlir.llvm.org/docs/Dialects/Builtin/#fusedloc suit the situation [of recording locations of macro expansions]?
> 
> Maybe? Right now I think `FusedLoc` is used by ClangIR to represent a source range. Maybe it also could be used for macro expansion locations. I don't if there is a `FusedLoc` metadata convention for that.
> 
> That would be something we want to explore and implement in the ClangIR incubator project first. It's not something I want to implement as part of an upstreaming change.

Understood, there is likely value to a 'FIXME' that has some sort of sub-locations/expansion locations suggested as a point of something we should fix in the future.  BUT, the current 'this is an array of locations' likely doesn't comprehend that well.

Currently when clang does diagnostics on a macro expansion, we do a bunch of notes of "in expansion of macro...", which includes the name and location of the macro being expanded.  It seems that `FusedLoc` would need some way of referring to a separate entity to get this, so I don't see it being useful for this.

Again though, a `FIXME: at one point we should capture macro expansions here so we can diagnose expansions more thoroughly` is perhaps not a bad addition here.

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


More information about the cfe-commits mailing list