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(
101
101
}
102
102
103
103
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);
113
109
} 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
+ }
115
117
}
116
118
}
117
119
}
You can’t perform that action at this time.
0 commit comments