@@ -6103,6 +6103,66 @@ static void HandleAddressSpaceTypeAttribute(QualType &Type,
6103
6103
}
6104
6104
}
6105
6105
6106
+ static void HandleSYCLFPGAPipeAttribute (QualType &Type, const ParsedAttr &Attr,
6107
+ TypeProcessingState &State) {
6108
+ Sema &S = State.getSema ();
6109
+ ASTContext &Ctx = S.Context ;
6110
+
6111
+ // Check the attribute arguments.
6112
+ if (Attr.getNumArgs () != 1 ) {
6113
+ S.Diag (Attr.getLoc (), diag::err_attribute_wrong_number_arguments)
6114
+ << Attr << 1 ;
6115
+ Attr.setInvalid ();
6116
+ return ;
6117
+ }
6118
+
6119
+ if (!Attr.isArgExpr (0 )) {
6120
+ S.Diag (Attr.getLoc (), diag::err_attribute_argument_type)
6121
+ << Attr << AANT_ArgumentString;
6122
+ Attr.setInvalid ();
6123
+ return ;
6124
+ }
6125
+
6126
+ StringRef Str;
6127
+ if (auto *SL = dyn_cast<StringLiteral>(Attr.getArgAsExpr (0 ))) {
6128
+ Str = SL->getString ();
6129
+ } else {
6130
+ S.Diag (Attr.getLoc (), diag::err_attribute_argument_type)
6131
+ << Attr << AANT_ArgumentString;
6132
+ Attr.setInvalid ();
6133
+ return ;
6134
+ }
6135
+
6136
+ bool isReadOnlyPipe;
6137
+ if (Str == " write_only" )
6138
+ isReadOnlyPipe = false ;
6139
+ else if (Str == " read_only" )
6140
+ isReadOnlyPipe = true ;
6141
+ else {
6142
+ S.Diag (Attr.getLoc (), diag::err_pipe_attribute_arg_not_allowed) << Str;
6143
+ Attr.setInvalid ();
6144
+ return ;
6145
+ }
6146
+
6147
+ auto *PipeAttr = ::new (Ctx) SYCLFPGAPipeAttr (Ctx, Attr, Str);
6148
+
6149
+ // Apply pipe qualifiers just to the equivalent type, as the expression is not
6150
+ // value dependent (not templated).
6151
+ QualType EquivType = isReadOnlyPipe
6152
+ ? S.BuildReadPipeType (Type, Attr.getLoc ())
6153
+ : S.BuildWritePipeType (Type, Attr.getLoc ());
6154
+ if (EquivType.isNull ()) {
6155
+ Attr.setInvalid ();
6156
+ return ;
6157
+ }
6158
+
6159
+ QualType T = State.getAttributedType (PipeAttr, Type, EquivType);
6160
+ if (!T.isNull ())
6161
+ Type = T;
6162
+ else
6163
+ Attr.setInvalid ();
6164
+ }
6165
+
6106
6166
// / handleObjCOwnershipTypeAttr - Process an objc_ownership
6107
6167
// / attribute on the specified type.
6108
6168
// /
@@ -7670,6 +7730,10 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type,
7670
7730
HandleOpenCLAccessAttr (type, attr, state.getSema ());
7671
7731
attr.setUsedAsTypeAttr ();
7672
7732
break ;
7733
+ case ParsedAttr::AT_SYCLFPGAPipe:
7734
+ HandleSYCLFPGAPipeAttribute (type, attr, state);
7735
+ attr.setUsedAsTypeAttr ();
7736
+ break ;
7673
7737
case ParsedAttr::AT_LifetimeBound:
7674
7738
if (TAL == TAL_DeclChunk)
7675
7739
HandleLifetimeBoundAttr (state, type, attr);
0 commit comments