[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Zhou Sheng
zhousheng00 at gmail.com
Wed Jun 6 23:12:25 PDT 2007
Changes in directory llvm/lib/VMCore:
Verifier.cpp updated: 1.212 -> 1.213
---
Log message:
Add assert to check if the attributes ZExt/SExt, NoAlias are apply to the
correct type of parameters.
---
Diffs of the changes: (+15 -0)
Verifier.cpp | 15 +++++++++++++++
1 files changed, 15 insertions(+)
Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.212 llvm/lib/VMCore/Verifier.cpp:1.213
--- llvm/lib/VMCore/Verifier.cpp:1.212 Wed May 2 20:11:54 2007
+++ llvm/lib/VMCore/Verifier.cpp Thu Jun 7 01:12:03 2007
@@ -46,6 +46,7 @@
#include "llvm/Pass.h"
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
+#include "llvm/ParameterAttributes.h"
#include "llvm/DerivedTypes.h"
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
@@ -358,6 +359,20 @@
FT->getNumParams() > 0 && isa<PointerType>(FT->getParamType(0))),
"Invalid struct-return function!", &F);
+ if (const ParamAttrsList *Attrs = FT->getParamAttrs()) {
+ unsigned Idx = 1;
+ for (FunctionType::param_iterator I = FT->param_begin(),
+ E = FT->param_end(); I != E; ++I, ++Idx) {
+ if (Attrs->paramHasAttr(Idx, ParamAttr::ZExt) ||
+ Attrs->paramHasAttr(Idx, ParamAttr::SExt))
+ Assert1(FT->getParamType(Idx-1)->isInteger(),
+ "Attribute ZExt should only apply to Integer type!", &F);
+ if (Attrs->paramHasAttr(Idx, ParamAttr::NoAlias))
+ Assert1(isa<PointerType>(FT->getParamType(Idx-1)),
+ "Attribute NoAlias should only apply to Pointer type!", &F);
+ }
+ }
+
// Check that this function meets the restrictions on this calling convention.
switch (F.getCallingConv()) {
default:
More information about the llvm-commits
mailing list