[llvm-commits] [llvm] r55414 - in /llvm/trunk: lib/VMCore/Verifier.cpp test/Verifier/byval-2.ll
Dan Gohman
gohman at apple.com
Wed Aug 27 07:48:06 PDT 2008
Author: djg
Date: Wed Aug 27 09:48:06 2008
New Revision: 55414
URL: http://llvm.org/viewvc/llvm-project?rev=55414&view=rev
Log:
Diagnose uses of unsized types with the byval attribute in the
verifier. See PR2711 for details.
Modified:
llvm/trunk/lib/VMCore/Verifier.cpp
llvm/trunk/test/Verifier/byval-2.ll
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=55414&r1=55413&r2=55414&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Aug 27 09:48:06 2008
@@ -421,6 +421,17 @@
ParameterAttributes TypeI = Attrs & ParamAttr::typeIncompatible(Ty);
Assert1(!TypeI, "Wrong type for attribute " +
ParamAttr::getAsString(TypeI), V);
+
+ ParameterAttributes ByValI = Attrs & ParamAttr::ByVal;
+ if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
+ Assert1(!ByValI || PTy->getElementType()->isSized(),
+ "Attribute " + ParamAttr::getAsString(ByValI) +
+ " does not support unsized types!", V);
+ } else {
+ Assert1(!ByValI,
+ "Attribute " + ParamAttr::getAsString(ByValI) +
+ " only applies to parameters with pointer type!", V);
+ }
}
// VerifyFunctionAttrs - Check parameter attributes against a function type.
Modified: llvm/trunk/test/Verifier/byval-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/byval-2.ll?rev=55414&r1=55413&r2=55414&view=diff
==============================================================================
--- llvm/trunk/test/Verifier/byval-2.ll (original)
+++ llvm/trunk/test/Verifier/byval-2.ll Wed Aug 27 09:48:06 2008
@@ -1,3 +1,4 @@
-; RUN: llvm-as %s -o /dev/null -f
+; RUN: not llvm-as < %s >& /dev/null
+; PR2711
%s = type opaque
declare void @h(%s* byval %num)
More information about the llvm-commits
mailing list