Files
codegraph/__tests__
Colby Mchenry 1b12bf5b49 fix(objc,c,cpp): an enum declared with NS_ENUM, NS_OPTIONS or CF_ENUM is indexed (#2694)
Foundation's enum macros declare most enums in Objective-C and in the C
and C++ headers beside it: `typedef NS_ENUM(NSInteger, SDImageCacheType)
{ … };`. The parser reads the macro as a broken typedef, so the enum and
its values were never indexed (SDWebImage had no enum at all), and a junk
type alias named after the first value, or after `(NSInteger, Name)` in
C++, stood in their place.

- c-cpp.ts: rewriteFoundationEnumMacros rewrites the macro in place as
  `enum Name {`. The `typedef`, the rest of the macro's name, its
  parentheses and its first argument (the underlying type, or an
  NS_ERROR_ENUM's domain) become spaces, so every offset stays. It matches
  on the code with comments, literals and directives masked, so the
  macro's own `#define` is left alone. NS_ENUM, NS_OPTIONS,
  NS_CLOSED_ENUM, NS_ERROR_ENUM, CF_ENUM, CF_OPTIONS and CF_CLOSED_ENUM
  share the shape. The C and C++ preParse run it first.
- objc.ts: preParse runs it before the lone-macro blank.

The kernel takes C and C++ input from the hoisted preParse, so it needs no
change. On the five repos' 1,342 C/C++ files the kernel and wasm agree
byte for byte, and 17 more files now parse clean enough for the kernel to
take them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 00:59:54 +00:00
..