Skip to content

cl compileFuncOrMethod: ignore if parent is ignored; ctx.varName support nsPrefix - #906

Merged
xushiwei merged 3 commits into
goplus:mainfrom
xushiwei:q
Oct 3, 2026
Merged

xushiwei merged 3 commits into
goplus:mainfrom
xushiwei:q

Conversation

@xushiwei

@xushiwei xushiwei commented Oct 3, 2026

Copy link
Copy Markdown
Member

No description provided.

@codecov

codecov Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.04%. Comparing base (6e0abd0) to head (5d7de60).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cl/name.go 80.00% 1 Missing ⚠️
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     
Flag Coverage Δ
llgo-tests 89.04% <90.90%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xushiwei xushiwei changed the title cl compileFuncOrMethod: ignore if parent is ignored cl compileFuncOrMethod: ignore if parent is ignored; ctx.varName support nsPrefix Oct 3, 2026

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and ns is the full enclosing namespace chain (cNS joins all semantic parents with ::), not just the immediate parent. Something like "enclosing namespace ignored, so ignored too" would read better. Matches the existing typedef.go wording, 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) — cNS lacks the decl.IsNull() guard that cNameOf has (name.go:74), terminating only on Cursor_TranslationUnit. This PR routes function compilation through cNS, widening its exposure; worth mirroring the cNameOf guard for robustness against malformed cursor chains.

Comment thread cl/func.go
@xushiwei
xushiwei merged commit d6e1cee into goplus:main Oct 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant