diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-10-09 09:51:10 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-10-09 09:51:10 +0000 |
commit | 943c29135e03e55f9a5dab393786171a4a536482 (patch) | |
tree | 7e8e95ae04dea6db150d6af46ad32333319a2afc /lib/VMCore/Verifier.cpp | |
parent | 15c3789763e82b7c781ea1ebcae24de826259b75 (diff) | |
download | external_llvm-943c29135e03e55f9a5dab393786171a4a536482.tar.gz external_llvm-943c29135e03e55f9a5dab393786171a4a536482.tar.bz2 external_llvm-943c29135e03e55f9a5dab393786171a4a536482.zip |
Move the 'ParameterOnly' variable inside of the Attributes class and make it a method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165497 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Verifier.cpp')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 6c60745d60..8b47f2518b 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -533,11 +533,10 @@ void Verifier::VerifyParameterAttrs(Attributes Attrs, Type *Ty, Assert1(!FnCheckAttr, "Attribute " + FnCheckAttr.getAsString() + " only applies to the function!", V); - if (isReturnValue) { - Attributes RetI = Attrs & Attribute::ParameterOnly; - Assert1(!RetI, "Attribute " + RetI.getAsString() + - " does not apply to return values!", V); - } + if (isReturnValue) + Assert1(!Attrs.hasParameterOnlyAttrs(), + "Attributes 'byval', 'nest', 'sret', and 'nocapture' " + "do not apply to return values!", V); for (unsigned i = 0; i < array_lengthof(Attribute::MutuallyIncompatible); ++i) { @@ -550,16 +549,14 @@ void Verifier::VerifyParameterAttrs(Attributes Attrs, Type *Ty, Assert1(!TypeI, "Wrong type for attribute " + TypeI.getAsString(), V); - Attributes ByValI = Attrs & Attribute::ByVal; - if (PointerType *PTy = dyn_cast<PointerType>(Ty)) { - Assert1(!ByValI || PTy->getElementType()->isSized(), - "Attribute " + ByValI.getAsString() + - " does not support unsized types!", V); - } else { - Assert1(!ByValI, - "Attribute " + ByValI.getAsString() + - " only applies to parameters with pointer type!", V); - } + if (PointerType *PTy = dyn_cast<PointerType>(Ty)) + Assert1(!Attrs.hasAttribute(Attributes::ByVal) || + PTy->getElementType()->isSized(), + "Attribute 'byval' does not support unsized types!", V); + else + Assert1(!Attrs.hasAttribute(Attributes::ByVal), + "Attribute 'byval' only applies to parameters with pointer type!", + V); } // VerifyFunctionAttrs - Check parameter attributes against a function type. |