File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -101,17 +101,19 @@ void SILFunctionBuilder::addFunctionAttributes(
101101 }
102102
103103 llvm::SmallVector<const EffectsAttr *, 8 > customEffects;
104- for (auto *attr : Attrs.getAttributes <EffectsAttr>()) {
105- auto *effectsAttr = cast<EffectsAttr>(attr);
106- if (effectsAttr->getKind () == EffectsKind::Custom) {
107- customEffects.push_back (effectsAttr);
108- } else {
109- if (F->getEffectsKind () != EffectsKind::Unspecified &&
110- F->getEffectsKind () != effectsAttr->getKind ()) {
111- mod.getASTContext ().Diags .diagnose (effectsAttr->getLocation (),
112- diag::warning_in_effects_attribute, " mismatching function effects" );
104+ if (constant) {
105+ for (auto *attr : Attrs.getAttributes <EffectsAttr>()) {
106+ auto *effectsAttr = cast<EffectsAttr>(attr);
107+ if (effectsAttr->getKind () == EffectsKind::Custom) {
108+ customEffects.push_back (effectsAttr);
113109 } else {
114- F->setEffectsKind (effectsAttr->getKind ());
110+ if (F->getEffectsKind () != EffectsKind::Unspecified &&
111+ F->getEffectsKind () != effectsAttr->getKind ()) {
112+ mod.getASTContext ().Diags .diagnose (effectsAttr->getLocation (),
113+ diag::warning_in_effects_attribute, " mismatching function effects" );
114+ } else {
115+ F->setEffectsKind (effectsAttr->getKind ());
116+ }
115117 }
116118 }
117119 }
You can’t perform that action at this time.
0 commit comments