const Attributes VarArgsIncompatible = StructRet;
/// @brief Attributes that are mutually incompatible.
-const Attributes MutuallyIncompatible[3] = {
+const Attributes MutuallyIncompatible[4] = {
ByVal | InReg | Nest | StructRet,
ZExt | SExt,
- ReadNone | ReadOnly
+ ReadNone | ReadOnly,
+ NoInline | AlwaysInline
};
/// @brief Which attributes cannot be applied to a type.
if (Attr.Attrs & Attribute::StructRet)
Assert1(Attr.Index == 1, "Attribute sret not on first parameter!", V);
}
+
+ Attributes FAttrs = Attrs.getFnAttributes();
+ for (unsigned i = 0;
+ i < array_lengthof(Attribute::MutuallyIncompatible); ++i) {
+ Attributes MutI = FAttrs & Attribute::MutuallyIncompatible[i];
+ Assert1(!(MutI & (MutI - 1)), "Attributes " +
+ Attribute::getAsString(MutI) + " are incompatible!", V);
+ }
+
+ Attributes RAttrs = Attrs.getRetAttributes();
+ for (unsigned i = 0;
+ i < array_lengthof(Attribute::MutuallyIncompatible); ++i) {
+ Attributes MutI = RAttrs & Attribute::MutuallyIncompatible[i];
+ Assert1(!(MutI & (MutI - 1)), "Attributes " +
+ Attribute::getAsString(MutI) + " are incompatible!", V);
+ }
+
}
static bool VerifyAttributeCount(const AttrListPtr &Attrs, unsigned Params) {