[clang] [CIR] Lowering to LLVM for global pointers (PR #125619)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 07:11:04 PST 2025


================
@@ -0,0 +1,51 @@
+#ifndef LLVM_CLANG_CIR_DIALECT_IR_CIRATTRVISITOR_H
+#define LLVM_CLANG_CIR_DIALECT_IR_CIRATTRVISITOR_H
+
+#include "clang/CIR/Dialect/IR/CIRAttrs.h"
+
+namespace cir {
+
+template <typename ImplClass, typename RetTy> class CirAttrVisitor {
+public:
+  // FIXME: Create a TableGen list to automatically handle new attributes
+  template <typename... Args>
+  RetTy visit(mlir::Attribute attr, Args &&...args) {
+    if (const auto intAttr = mlir::dyn_cast<cir::IntAttr>(attr))
+      return static_cast<ImplClass *>(this)->visitCirIntAttr(
----------------
erichkeane wrote:

I suggest a `getDerived` instead of the `static_cast` everywhere. 

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


More information about the cfe-commits mailing list