From 2de0105db7c3268bcfc6405fb26dfe61cd749f2a Mon Sep 17 00:00:00 2001 From: Yuri Iozzelli Date: Tue, 10 Oct 2023 12:49:32 +0200 Subject: [PATCH] forbid client value types in arguments --- clang/lib/Sema/SemaCheerp.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clang/lib/Sema/SemaCheerp.cpp b/clang/lib/Sema/SemaCheerp.cpp index 58b00a7c9a69..a231026e3c68 100644 --- a/clang/lib/Sema/SemaCheerp.cpp +++ b/clang/lib/Sema/SemaCheerp.cpp @@ -509,12 +509,17 @@ void cheerp::checkFunctionOnDeclaration(clang::FunctionDecl* FD, clang::Sema& se if (!isAlsoDefinition) TypeChecker::checkSignature(FD, sema); } - // Check if any parameters to a function with genericJS attribute are vectors. if (FD->hasAttr()) { 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(); + if (auto* PD = P->getType()->getAsTagDecl()) { + if (clang::AnalysisDeclContext::isInClientNamespace(PD)) { + sema.Diag(P->getLocation(), clang::diag::err_cheerp_client_layout_lvalue); + } + } } }