Skip to content

cl refactor: add preload stage - #893

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

xushiwei merged 6 commits into
goplus:mainfrom
xushiwei:q

Conversation

@xushiwei

@xushiwei xushiwei commented Oct 2, 2026

Copy link
Copy Markdown
Member

No description provided.

@codecov

codecov Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.89320% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.84%. Comparing base (f82e839) to head (704e214).
⚠️ Report is 34 commits behind head on main.

Files with missing lines Patch % Lines
cl/preload.go 87.83% 18 Missing ⚠️
cl/class.go 70.37% 8 Missing ⚠️
cl/type.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #893      +/-   ##
==========================================
- Coverage   87.64%   86.84%   -0.80%     
==========================================
  Files          23       24       +1     
  Lines        1991     2015      +24     
==========================================
+ Hits         1745     1750       +5     
- Misses        246      265      +19     
Flag Coverage Δ
llgo-tests 86.84% <86.89%> (-0.80%) ⬇️

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 merged commit bd9d8b1 into goplus:main Oct 2, 2026
2 of 4 checks passed
@xushiwei
xushiwei deleted the q branch October 3, 2026 02:16
fennoai Bot pushed a commit that referenced this pull request Oct 3, 2026
…ups (#894)

The real cause of the hang (not the class-body re-init theory from the
earlier commits, which are reverted here): the #893 refactor merged
function and class-template overloads into a single overloads.items
list, and overloads.reorder() now sorts the whole group with a
comparator meant only for function overloads.

For a class template and its partial specializations (which share one
C/C++ name, e.g. llvm::DenseMapInfo and its 6 specializations), the
clang cursor is not a function, so NumArguments() returns -1. That -1
was fed into 'for k := range c.Uint(na)', and c.Uint(-1) wraps to
~4,294,967,295, so each comparison spun ~4.3 billion iterations calling
Argument(k).Type() on out-of-range indices -- effectively an infinite
hang on the LLVM ADT fixtures (DenseMapInfo, STLForwardCompat) that
carry such specialization groups. Pre-refactor this never happened
because reorder() sorted only the function list (p.fns).

Fix: clamp a negative NumArguments() to 0 so non-function cursors are
treated as argument-less and skip the argument comparison, keeping the
existing ordering for real function overloads byte-for-byte.

Reproduced and verified end-to-end with llgo + clang-22.1.8:
TestLLVM_DenseMapInfo and TestLLVM_STLForwardCompat now complete in
<1s (previously hung) and the full tool LLVM suite passes. The
STLForwardCompat golden out.go is updated to the deterministic
source-order output the three-stage pipeline now emits.

Reverts the ineffective initClassType guards from the previous two
commits on this branch.
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