Fix bugs in checks for varying parameters in exported functions.
In short, we inadvertently weren't checking whether pointers themselves were varying, which in turn led to an assertion later if an exported function did have a varying parameter. Issue #187.
This commit is contained in:
21
module.cpp
21
module.cpp
@@ -343,8 +343,6 @@ Module::AddGlobalVariable(Symbol *sym, Expr *initExpr, bool isConst) {
|
|||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
lRecursiveCheckValidParamType(const Type *t) {
|
lRecursiveCheckValidParamType(const Type *t) {
|
||||||
t = t->GetBaseType();
|
|
||||||
|
|
||||||
const StructType *st = dynamic_cast<const StructType *>(t);
|
const StructType *st = dynamic_cast<const StructType *>(t);
|
||||||
if (st != NULL) {
|
if (st != NULL) {
|
||||||
for (int i = 0; i < st->GetElementCount(); ++i)
|
for (int i = 0; i < st->GetElementCount(); ++i)
|
||||||
@@ -352,15 +350,16 @@ lRecursiveCheckValidParamType(const Type *t) {
|
|||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (t->IsVaryingType())
|
const SequentialType *seqt = dynamic_cast<const SequentialType *>(t);
|
||||||
return true;
|
if (seqt != NULL)
|
||||||
const PointerType *pt = dynamic_cast<const PointerType *>(t);
|
return lRecursiveCheckValidParamType(seqt->GetElementType());
|
||||||
if (pt != NULL && pt->IsSlice())
|
|
||||||
return true;
|
const PointerType *pt = dynamic_cast<const PointerType *>(t);
|
||||||
else
|
if (pt != NULL)
|
||||||
return false;
|
return (pt->IsSlice() || pt->IsVaryingType());
|
||||||
}
|
|
||||||
|
return t->IsVaryingType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user