Small cleanup for handling of type/parameter attribute

incompatibility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45704 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands
2008-01-07 17:16:06 +00:00
parent 30d15751c8
commit 6c3470efdc
5 changed files with 28 additions and 29 deletions

View File

@@ -186,19 +186,21 @@ ParamAttrsList::excludeAttrs(const ParamAttrsList *PAL,
return getModified(PAL, modVec);
}
uint16_t ParamAttr::incompatibleWithType (const Type *Ty, uint16_t attrs) {
uint16_t ParamAttr::typeIncompatible (const Type *Ty) {
uint16_t Incompatible = None;
if (!Ty->isInteger())
Incompatible |= IntegerTypeOnly;
// Attributes that only apply to integers.
Incompatible |= SExt | ZExt;
if (!isa<PointerType>(Ty))
Incompatible |= PointerTypeOnly;
else if (attrs & ParamAttr::ByVal) {
const PointerType *PTy = cast<PointerType>(Ty);
if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
if (!isa<StructType>(PTy->getElementType()))
// Attributes that only apply to pointers to structs.
Incompatible |= ParamAttr::ByVal;
} else {
// Attributes that only apply to pointers.
Incompatible |= ByVal | Nest | NoAlias | StructRet;
}
return attrs & Incompatible;
return Incompatible;
}