summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Verifier.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-09 09:51:10 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-09 09:51:10 +0000
commit908126a7456739bcd3b5118cf474710a0d9c85f4 (patch)
tree6697d9d6af2f1bf8a5a0756c5376dbfe5017f385 /llvm/lib/VMCore/Verifier.cpp
parent217c9b1916c955c8e8fad822e45ecebecb2bbc4e (diff)
downloadbcm5719-llvm-908126a7456739bcd3b5118cf474710a0d9c85f4.tar.gz
bcm5719-llvm-908126a7456739bcd3b5118cf474710a0d9c85f4.zip
Move the 'ParameterOnly' variable inside of the Attributes class and make it a method.
llvm-svn: 165497
Diffstat (limited to 'llvm/lib/VMCore/Verifier.cpp')
-rw-r--r--llvm/lib/VMCore/Verifier.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp
index 6c60745d60f..8b47f2518b9 100644
--- a/llvm/lib/VMCore/Verifier.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud