Skip to content

Commit

Permalink
forbid client value types in arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri91 committed Oct 18, 2024
1 parent b16bb40 commit 2de0105
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion clang/lib/Sema/SemaCheerp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,17 @@ void cheerp::checkFunctionOnDeclaration(clang::FunctionDecl* FD, clang::Sema& se
if (!isAlsoDefinition)
TypeChecker::checkSignature<cheerp::TypeChecker::KindOfFunction::NamespaceClient, cheerp::TypeChecker::FailureMode::Diagnostic>(FD, sema);
}
// Check if any parameters to a function with genericJS attribute are vectors.
if (FD->hasAttr<clang::GenericJSAttr>()) {
for (clang::ParmVarDecl* P: FD->parameters())
{
// Check if any parameters to a function with genericJS attribute are vectors.
if (P->getType()->isVectorType())
sema.Diag(P->getLocation(), clang::diag::err_cheerp_vector_from_genericjs) << "have parameter" << P << FD << FD->getAttr<clang::GenericJSAttr>();
if (auto* PD = P->getType()->getAsTagDecl()) {
if (clang::AnalysisDeclContext::isInClientNamespace(PD)) {
sema.Diag(P->getLocation(), clang::diag::err_cheerp_client_layout_lvalue);
}
}
}
}

Expand Down

0 comments on commit 2de0105

Please sign in to comment.