[clang] [clang][Sema] Fix ObjC file-scope literal diagnostic under -fobjc-arc (PR #209688)

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 22 03:51:14 PDT 2026


ahatanak wrote:

It looks like the root cause in `CheckForConstantInitializer` is that the per-element checks look at `Init` instead of `Culprit` (or an unwrapped version of it) when dispatching to `dyn_cast<ObjCArrayLiteral>` or `dyn_cast<ObjCDictionaryLiteral>`, so if `Init` is still wrapped, the per-element loop is skipped entirely. Also, the key check ignores that `ObjCStringLiteral` keys are wrapped in an implicit `BitCast` (`isa<ObjCStringLiteral>(Elm.Key)` checks the cast node, not the underlying literal), which is why a valid string key still gets misidentified as the culprit.

https://github.com/llvm/llvm-project/pull/209688


More information about the cfe-commits mailing list