diff options
author | Duncan Sands <baldrick@free.fr> | 2008-01-07 17:16:06 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-01-07 17:16:06 +0000 |
commit | 6c3470efdc59245707c56ad92ab8355afdac2c62 (patch) | |
tree | 77b2dcecfd33686814466ce48d121cbdb6f37217 /lib/VMCore/ParameterAttributes.cpp | |
parent | 30d15751c8f9d905c1402d9ff84acdcb2265bb8c (diff) | |
download | external_llvm-6c3470efdc59245707c56ad92ab8355afdac2c62.zip external_llvm-6c3470efdc59245707c56ad92ab8355afdac2c62.tar.gz external_llvm-6c3470efdc59245707c56ad92ab8355afdac2c62.tar.bz2 |
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
Diffstat (limited to 'lib/VMCore/ParameterAttributes.cpp')
-rw-r--r-- | lib/VMCore/ParameterAttributes.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/VMCore/ParameterAttributes.cpp b/lib/VMCore/ParameterAttributes.cpp index 840d54b..77a2a6e 100644 --- a/lib/VMCore/ParameterAttributes.cpp +++ b/lib/VMCore/ParameterAttributes.cpp @@ -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; } |