[clang] [C] Allow __attribute__((nonstring)) on multidimensional arrays (PR #138133)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu May 1 07:59:55 PDT 2025
================
@@ -261,8 +261,21 @@ static void CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT,
<< Str->getSourceRange();
else if (StrLength - 1 == ArrayLen) {
// If the entity being initialized has the nonstring attribute, then
- // silence the "missing nonstring" diagnostic.
- if (const ValueDecl *D = Entity.getDecl();
+ // silence the "missing nonstring" diagnostic. If there's no entity,
+ // check whether we're initializing an array of arrays; if so, walk the
+ // parents to find an entity.
+ auto FindCorrectEntity = [](const InitializedEntity &Entity) {
+ const ValueDecl *Ret = nullptr;
----------------
AaronBallman wrote:
I've updated to make it more clear and added additional test coverage.
https://github.com/llvm/llvm-project/pull/138133
More information about the cfe-commits
mailing list