https://github.com/ordinary-jamie created
https://github.com/llvm/llvm-project/pull/214767
Add missing forward decl for `CIRGenerator.h` to make it self contained..
```sh
cat<<EOF >> test.cpp
#include "clang/CIR/CIRGenerator.h"
int main() {}
EOF
clang++ -std=c++17 -fsyntax-only test.cpp -I$(brew --prefix llvm)/include/
In file included from test.cpp:2:
/opt/homebrew/opt/llvm/include/clang/CIR/CIRGenerator.h:90:9: error: no type
named 'ModuleOp' in namespace 'mlir'
90 | mlir::ModuleOp getModule() const;
| ~~~~~~^
1 error generated.
```
Found this while trying to create an Clang FrontEnd action in an out-of-tree
project.
Went with a forward decl since its already done in the file + recommendations
from https://llvm.org/docs/CodingStandards.html#minimal-list-of-includes
>From 1c1221dbfc68f2287c5561a9adfaccc25170580e Mon Sep 17 00:00:00 2001
From: ordinary-jamie <[email protected]>
Date: Sat, 8 Aug 2026 00:56:42 +1000
Subject: [PATCH] [CIR] Forward-declare mlir::ModuleOp in CIRGenerator.h
---
clang/include/clang/CIR/CIRGenerator.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/clang/include/clang/CIR/CIRGenerator.h
b/clang/include/clang/CIR/CIRGenerator.h
index 31dead2d7b585..7018b86ad16ea 100644
--- a/clang/include/clang/CIR/CIRGenerator.h
+++ b/clang/include/clang/CIR/CIRGenerator.h
@@ -32,6 +32,7 @@ class CIRGenModule;
namespace mlir {
class MLIRContext;
+class ModuleOp;
} // namespace mlir
namespace cir {
class CIRGenerator : public clang::ASTConsumer {
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits