Revert "Revert "cl refactor: add preload stage"" - #901
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #901 +/- ##
==========================================
- Coverage 89.38% 88.54% -0.85%
==========================================
Files 20 21 +1
Lines 1922 1946 +24
==========================================
+ Hits 1718 1723 +5
- Misses 204 223 +19
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: re-apply class/function loading refactor
This PR re-applies the two-phase load refactor in cl/ (unifying funcObj/templateClass into overloadObj, splitting preload/load/compile phases via the new cl/preload.go). The build passes (go build ./cl/...) and the refactor logic reads soundly: newClassCtx nil handling is correctly guarded in loadClass/loadTemplateClass, the two-queue compile() flow runs each unit once, and preloadClass's NumTemplateArguments() >= 0 check is correct (-1 = not a template).
Main findings are inline. In short:
addOveerloadObjis misspelled (double "e") across its definition, 4 call sites, and the debug log string in a brand-new file — worth fixing now before it gets entrenched.- Two LLVM tests were silently disabled by renaming to
_Test..., one with a leftover debuglog.Println. No comment or tracking reason;t.Skip("reason")would keep the skip visible. - A bare
panicon a nested partial specialization (cl/class.go:352) replaces the previous graceful handling — a valid-but-unsupported C++ construct now hard-crashes the generator with no source location.
Non-blocking observations:
- Performance:
newClassCtxadds a secondclang.VisitChildrenpass over each class's members (the first beinginitClassTypeEx, whereloadClassMemberis now a no-op for methods). This appears intentional — method USRs must be preloaded before out-of-line definitions resolve inloadOutsideMethod— but it does double the per-class child walk; worth confirming it's needed for classes with no out-of-line methods. - Docs:
cl/class.goremoved the "class name acts like a namespace" rationale comments on the static-VarDecland nested-class branches, which leaves the "same reason as a named nested class/struct above" cross-reference on the nested-union branch dangling. Also,compileFuncOrMethod's doc still describes aclsparameter that is now namedthis.
| } | ||
|
|
||
| func TestLLVM_DenseMapInfo(t *testing.T) { | ||
| func _TestLLVM_DenseMapInfo(t *testing.T) { |
There was a problem hiding this comment.
Renaming to _TestLLVM_DenseMapInfo removes this from the Go test runner with no compile/lint signal and no explanation — coverage is lost invisibly. If intentional, add a comment/tracking issue, or use t.Skip("reason") so the skip is visible in test output.
Reverts #895