Skip to content

[clang][CIR] Add missing dependency on MLIR headers #131057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 17, 2025

Conversation

darkbuck
Copy link
Contributor

No description provided.

@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Mar 13, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 13, 2025

@llvm/pr-subscribers-clangir

Author: None (darkbuck)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/131057.diff

2 Files Affected:

  • (modified) clang/lib/CIR/FrontendAction/CMakeLists.txt (+3)
  • (modified) clang/lib/FrontendTool/CMakeLists.txt (+5)
diff --git a/clang/lib/CIR/FrontendAction/CMakeLists.txt b/clang/lib/CIR/FrontendAction/CMakeLists.txt
index 6d5a8758468f6..df0e075fb7532 100644
--- a/clang/lib/CIR/FrontendAction/CMakeLists.txt
+++ b/clang/lib/CIR/FrontendAction/CMakeLists.txt
@@ -11,6 +11,9 @@ add_clang_library(clangCIRFrontendAction
   DEPENDS
   MLIRCIROpsIncGen
   MLIRCIROpInterfacesIncGen
+  # Add mlir-generic-headers dependency as the header CIRGenAction.h needs to
+  # include BuiltinOps.h
+  mlir-generic-headers
 
   LINK_LIBS
   clangAST
diff --git a/clang/lib/FrontendTool/CMakeLists.txt b/clang/lib/FrontendTool/CMakeLists.txt
index d7a3699361f0a..5a828ce239c64 100644
--- a/clang/lib/FrontendTool/CMakeLists.txt
+++ b/clang/lib/FrontendTool/CMakeLists.txt
@@ -15,6 +15,11 @@ set(link_libs
 set(deps)
 
 if(CLANG_ENABLE_CIR)
+  # Add mlir-generic-headers dependency as the header CIRGenAction.h needs to
+  # include BuiltinOps.h
+  list(APPEND deps
+    mlir-generic-headers
+  )
   list(APPEND link_libs
     clangCIRFrontendAction
     MLIRIR

@llvmbot
Copy link
Member

llvmbot commented Mar 13, 2025

@llvm/pr-subscribers-clang

Author: None (darkbuck)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/131057.diff

2 Files Affected:

  • (modified) clang/lib/CIR/FrontendAction/CMakeLists.txt (+3)
  • (modified) clang/lib/FrontendTool/CMakeLists.txt (+5)
diff --git a/clang/lib/CIR/FrontendAction/CMakeLists.txt b/clang/lib/CIR/FrontendAction/CMakeLists.txt
index 6d5a8758468f6..df0e075fb7532 100644
--- a/clang/lib/CIR/FrontendAction/CMakeLists.txt
+++ b/clang/lib/CIR/FrontendAction/CMakeLists.txt
@@ -11,6 +11,9 @@ add_clang_library(clangCIRFrontendAction
   DEPENDS
   MLIRCIROpsIncGen
   MLIRCIROpInterfacesIncGen
+  # Add mlir-generic-headers dependency as the header CIRGenAction.h needs to
+  # include BuiltinOps.h
+  mlir-generic-headers
 
   LINK_LIBS
   clangAST
diff --git a/clang/lib/FrontendTool/CMakeLists.txt b/clang/lib/FrontendTool/CMakeLists.txt
index d7a3699361f0a..5a828ce239c64 100644
--- a/clang/lib/FrontendTool/CMakeLists.txt
+++ b/clang/lib/FrontendTool/CMakeLists.txt
@@ -15,6 +15,11 @@ set(link_libs
 set(deps)
 
 if(CLANG_ENABLE_CIR)
+  # Add mlir-generic-headers dependency as the header CIRGenAction.h needs to
+  # include BuiltinOps.h
+  list(APPEND deps
+    mlir-generic-headers
+  )
   list(APPEND link_libs
     clangCIRFrontendAction
     MLIRIR

@darkbuck
Copy link
Contributor Author

This patch is to fix the build failure once CIR is enabled. The error reads like

llvm-project/llvm/../mlir/include/mlir/IR/Location.h:145:10: fatal error: mlir/IR/BuiltinLocationAttributes.h.inc: No such file or directory

- Add dependency on MLIRBuiltinOpsIncGen as
  "clang/CIR/FrontendAction/CIRGenAction.h" needs to include
  "mlir/IR/BuiltinOps.h"
@darkbuck darkbuck force-pushed the hliao/main/fix-cir-dependency branch from c716e64 to 255050e Compare March 14, 2025 17:28
@bcardosolopes bcardosolopes merged commit f6a7306 into llvm:main Mar 17, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants