fix(extraction): broaden the curated C++ inline-macro library list (#1103)
* fix(extraction): broaden the curated C++ inline-macro library list Since #1102 the post-parse salvage already recovers the NAME for any macro, so adding a library now buys full return-type recovery for it. Extend the curated list across the major C++ ecosystem: Mozilla/SpiderMonkey, Protobuf, {fmt}, Hedley + nlohmann/json, GLM, Bullet (SIMD_FORCE_INLINE), Skia, OpenCV, EASTL, Cocos2d-x, Chromium/WebKit (NEVER_INLINE), GLib, SQLite, and the unambiguous Windows calling conventions (WINAPI / APIENTRY / STDMETHODCALLTYPE / WINAPIV — which sit between the return type and the name, so blanking them recovers the return type, e.g. `HRESULT WINAPI Foo()` -> Foo : HRESULT). Every entry is an exact, curated token matched only in specifier position, so a real all-caps return type is never touched. Anything still missed keeps its name via the universal salvage. CARLA control unchanged (440->6 mangles, 0 regressions — none of these libs appear there, confirming no collateral). Eleven representative full-recovery tests added. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(changelog): note broadened C++ inline-macro library coverage (#1103) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
cb20a3bf7f
commit
00765200d8
@@ -3048,6 +3048,25 @@ class APXCharacter { // the one real definition
|
||||
expect(namesOf('V8_INLINE MaybeLocal Get(int i) { return H(i); }')).toContain('Get');
|
||||
expect(namesOf('RAPIDJSON_FORCEINLINE bool Parse(const char* s) { return H(s); }')).toContain('Parse');
|
||||
});
|
||||
|
||||
it('curated list spans the broader ecosystem (Mozilla, GLM, Bullet, OpenCV, Skia, EASTL, protobuf, fmt, Windows conventions)', () => {
|
||||
const info = (c: string) =>
|
||||
extractFromSource('x.cpp', c).nodes
|
||||
.filter((n) => n.kind === 'method' || n.kind === 'function')
|
||||
.map((n) => ({ name: n.name, ret: n.returnType }));
|
||||
expect(info('MOZ_ALWAYS_INLINE Value get(int i) { return H(i); }')).toEqual([{ name: 'get', ret: 'Value' }]);
|
||||
expect(info('GLM_FUNC_QUALIFIER vec3 cross(const vec3& a) { return H(a); }')).toEqual([{ name: 'cross', ret: 'vec3' }]);
|
||||
expect(info('SIMD_FORCE_INLINE btScalar dot(const btVector3& v) const { return H(v); }')).toEqual([{ name: 'dot', ret: 'btScalar' }]);
|
||||
expect(info('CV_INLINE Mat clone() const { return H(); }')).toEqual([{ name: 'clone', ret: 'Mat' }]);
|
||||
expect(namesOf('PROTOBUF_ALWAYS_INLINE int size() const { return H(); }')).toContain('size');
|
||||
expect(namesOf('FMT_CONSTEXPR auto parse(int x) { return H(x); }')).toContain('parse');
|
||||
expect(namesOf('SK_ALWAYS_INLINE SkScalar width() const { return H(); }')).toContain('width');
|
||||
expect(namesOf('EA_FORCE_INLINE size_type size() const { return H(); }')).toContain('size');
|
||||
// Windows calling-convention macros sit between return type and name; the
|
||||
// macro is blanked so the real return type survives.
|
||||
expect(info('HRESULT WINAPI CreateThing(int x) { return H(x); }')).toEqual([{ name: 'CreateThing', ret: 'HRESULT' }]);
|
||||
expect(info('ULONG STDMETHODCALLTYPE AddRef() { return H(); }')).toEqual([{ name: 'AddRef', ret: 'ULONG' }]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('C++ templated base-class inheritance (#1043)', () => {
|
||||
|
||||
Reference in New Issue
Block a user