cl compileFuncOrMethod: ignore if parent is ignored; ctx.varName support nsPrefix - #906
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #906 +/- ##
==========================================
- Coverage 89.04% 89.04% -0.01%
==========================================
Files 21 21
Lines 1972 1981 +9
==========================================
+ Hits 1756 1764 +8
- Misses 216 217 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Review: cl compileFuncOrMethod — ignore if parent is ignored
Clean, well-targeted change that lets a function inherit the ignore state of its enclosing namespace/class, mirroring the existing loadTypedef pattern. The cNameOf(fn) → cNameWithNS(clang.String(fn), ns) refactor is equivalent for functions (a function cursor's spelling has no type tag, so trimTypeTag is a no-op) and nicely avoids walking the parent chain twice since ns is reused by the nsFeats check. Empty-namespace / C global functions are handled correctly (nsFeats("") returns 0), performance is neutral, and no security issues were found in the diff.
One consistency item inline. A couple of minor, discretionary notes below.
Minor / discretionary:
cl/func.go:76— message wording: "its parent is ignored, ignored too" is awkward, andnsis the full enclosing namespace chain (cNSjoins all semantic parents with::), not just the immediate parent. Something like "enclosing namespace ignored, so ignored too" would read better. Matches the existingtypedef.gowording, so low priority.cl/func.go:54-60— the doc comment still describes only the receiver semantics and doesn't mention the new "inherited ignore" path. Optional, since the other ignore branches in this function are likewise undocumented in the header.cl/name.go:82-95(pre-existing, not in this diff) —cNSlacks thedecl.IsNull()guard thatcNameOfhas (name.go:74), terminating only onCursor_TranslationUnit. This PR routes function compilation throughcNS, widening its exposure; worth mirroring thecNameOfguard for robustness against malformed cursor chains.
No description provided.