================ @@ -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; ---------------- erichkeane wrote:
This feels really difficult to reason about. Best I can tell the intent here is to search for the first 'decl' in the entity chain, but only going 'up' if we are in an array. BTW, should this check `InitializedEntity::EntityKind` instead? It seems to handle what it should, and I'm not sure I can come up with clearer though. https://github.com/llvm/llvm-project/pull/138133 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits