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:
19
module.cpp
19
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)
|
||||||
|
return lRecursiveCheckValidParamType(seqt->GetElementType());
|
||||||
|
|
||||||
const PointerType *pt = dynamic_cast<const PointerType *>(t);
|
const PointerType *pt = dynamic_cast<const PointerType *>(t);
|
||||||
if (pt != NULL && pt->IsSlice())
|
if (pt != NULL)
|
||||||
return true;
|
return (pt->IsSlice() || pt->IsVaryingType());
|
||||||
else
|
|
||||||
return false;
|
return t->IsVaryingType();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user