diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index e211c0de1faa9..b9c0f05ec3a82 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -6513,17 +6513,32 @@ static void handleSYCLIntelNoGlobalWorkOffsetAttr(Sema &S, Decl *D, S.AddSYCLIntelNoGlobalWorkOffsetAttr(D, A, E); } -/// Handle the [[intel::doublepump]] and [[intel::singlepump]] -/// attributes. -template -static void handleIntelFPGAPumpAttr(Sema &S, Decl *D, const ParsedAttr &A) { - checkForDuplicateAttribute(S, D, A); +/// Handle the [[intel::singlepump]] attribute. +static void handleSYCLIntelFPGASinglePumpAttr(Sema &S, Decl *D, + const ParsedAttr &AL) { + checkForDuplicateAttribute(S, D, AL); + + // If the declaration does not have an [[intel::fpga_memory]] + // attribute, this creates one as an implicit attribute. + if (!D->hasAttr()) + D->addAttr(IntelFPGAMemoryAttr::CreateImplicit( + S.Context, IntelFPGAMemoryAttr::Default)); + + D->addAttr(::new (S.Context) IntelFPGASinglePumpAttr(S.Context, AL)); +} +/// Handle the [[intel::doublepump]] attribute. +static void handleSYCLIntelFPGADoublePumpAttr(Sema &S, Decl *D, + const ParsedAttr &AL) { + checkForDuplicateAttribute(S, D, AL); + + // If the declaration does not have an [[intel::fpga_memory]] + // attribute, this creates one as an implicit attribute. if (!D->hasAttr()) D->addAttr(IntelFPGAMemoryAttr::CreateImplicit( S.Context, IntelFPGAMemoryAttr::Default)); - handleSimpleAttribute(S, D, A); + D->addAttr(::new (S.Context) IntelFPGADoublePumpAttr(S.Context, AL)); } /// Handle the [[intel::fpga_memory]] attribute. @@ -10558,10 +10573,10 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, // Intel FPGA specific attributes case ParsedAttr::AT_IntelFPGADoublePump: - handleIntelFPGAPumpAttr(S, D, AL); + handleSYCLIntelFPGADoublePumpAttr(S, D, AL); break; case ParsedAttr::AT_IntelFPGASinglePump: - handleIntelFPGAPumpAttr(S, D, AL); + handleSYCLIntelFPGASinglePumpAttr(S, D, AL); break; case ParsedAttr::AT_IntelFPGAMemory: handleIntelFPGAMemoryAttr(S, D, AL);