Skip to content

Commit 8f9361a

Browse files
committed
Use the right decl for subscripts and computed properties to get the function attributes from.
Otherwise @_semantics, @_specialize and @_optimize don't work for such declarations.
1 parent 8846fdf commit 8f9361a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/SIL/SILModule.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,10 @@ SILFunction *SILModule::getOrCreateFunction(SILLocation loc,
334334
if (constant.isForeign && decl->hasClangNode())
335335
F->setClangNodeOwner(decl);
336336

337+
if (auto *FDecl = dyn_cast<FuncDecl>(decl)) {
338+
if (auto *StorageDecl = FDecl->getAccessorStorageDecl())
339+
decl = StorageDecl;
340+
}
337341
// Propagate @_semantics.
338342
auto Attrs = decl->getAttrs();
339343
for (auto *A : Attrs.getAttributes<SemanticsAttr>())

0 commit comments

Comments
 (0)