-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'llvm:main' into features/hip-device
- Loading branch information
Showing
6 changed files
with
141 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//===- CIRAttrVisitor.h - Visitor for CIR attributes ------------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file defines the CirAttrVisitor interface. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#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 { | ||
|
||
#define DISPATCH(NAME) return getImpl()->visitCir##NAME(cirAttr); | ||
|
||
template <typename ImplClass, typename RetTy> class CirAttrVisitor { | ||
public: | ||
RetTy visit(mlir::Attribute attr) { | ||
#define ATTRDEF(NAME) \ | ||
if (const auto cirAttr = mlir::dyn_cast<cir::NAME>(attr)) \ | ||
DISPATCH(NAME); | ||
#include "clang/CIR/Dialect/IR/CIRAttrDefsList.inc" | ||
llvm_unreachable("unhandled attribute type"); | ||
} | ||
|
||
// If the implementation chooses not to implement a certain visit | ||
// method, fall back to the parent. | ||
#define ATTRDEF(NAME) \ | ||
RetTy visitCir##NAME(NAME cirAttr) { DISPATCH(Attr); } | ||
#include "clang/CIR/Dialect/IR/CIRAttrDefsList.inc" | ||
|
||
RetTy visitCirAttr(mlir::Attribute attr) { return RetTy(); } | ||
|
||
ImplClass *getImpl() { return static_cast<ImplClass *>(this); } | ||
}; | ||
|
||
#undef DISPATCH | ||
|
||
} // namespace cir | ||
|
||
#endif // LLVM_CLANG_CIR_DIALECT_IR_CIRATTRVISITOR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.