File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
include/clang/CIR/Dialect/IR Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 15
15
16
16
#include " mlir/IR/Attributes.h"
17
17
#include " mlir/IR/BuiltinAttributeInterfaces.h"
18
+ #include " mlir/IR/OpImplementation.h"
18
19
19
20
#include " clang/CIR/Dialect/IR/CIROpsEnums.h"
20
21
@@ -50,4 +51,24 @@ class VectorType;
50
51
#define GET_ATTRDEF_CLASSES
51
52
#include " clang/CIR/Dialect/IR/CIROpsAttributes.h.inc"
52
53
54
+ template <> struct ::mlir::FieldParser<cir::TBAAAttr, cir::TBAAAttr> {
55
+ static mlir::FailureOr<cir::TBAAAttr> parse (mlir::AsmParser &parser) {
56
+ mlir::Attribute attribute;
57
+ if (parser.parseAttribute (attribute))
58
+ return mlir::failure ();
59
+ if (auto omnipotentChar =
60
+ mlir::dyn_cast<cir::TBAAOmnipotentCharAttr>(attribute))
61
+ return omnipotentChar;
62
+ if (auto vtablePtr = mlir::dyn_cast<cir::TBAAVTablePointerAttr>(attribute))
63
+ return vtablePtr;
64
+ if (auto scalar = mlir::dyn_cast<cir::TBAAScalarAttr>(attribute))
65
+ return scalar;
66
+ if (auto tag = mlir::dyn_cast<cir::TBAATagAttr>(attribute))
67
+ return tag;
68
+ if (auto structAttr = mlir::dyn_cast<cir::TBAAStructAttr>(attribute))
69
+ return structAttr;
70
+ return parser.emitError (parser.getCurrentLocation (), " Expected TBAAAttr" );
71
+ }
72
+ };
73
+
53
74
#endif // CLANG_CIR_DIALECT_IR_CIRATTRS_H
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir -o %t -O1
2
+ // RUN: cir-opt %t
3
+
4
+ struct S {
5
+ short i;
6
+ };
7
+
8
+ struct S glob;
9
+ int main (void ) {
10
+ glob.i = 0 ;
11
+ return glob.i ;
12
+ }
You can’t perform that action at this time.
0 commit comments