Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions cl/preload.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,21 @@ func (p *overloads) reorder() {
if len(items) > 1 {
sort.SliceStable(items, func(i, j int) bool {
a, b := items[i].decl, items[j].decl
// NumArguments reports -1 for cursors that are not functions or
// methods (e.g. a class template and its partial specializations,
// which share one overload group under the same C/C++ name). Clamp
// to 0 so such cursors are treated as having no arguments: the
// argument-based ordering below is only meaningful for function
// overloads, and feeding -1 into the unsigned loop counter c.Uint(na)
// would otherwise wrap to ~4.3 billion iterations and hang the
// generator. See issue goplus/llcppg#894.
na, nb := a.NumArguments(), b.NumArguments()
if na < 0 {
na = 0
}
if nb < 0 {
nb = 0
}
if na != nb {
return na < nb
}
Expand Down
8 changes: 4 additions & 4 deletions tool/_testcpp/llvm-22.1.8-support/STLForwardCompat/out.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import "github.com/goplus/lib/c"

const LLGoPackage = "link: -L$(llvm-config --libdir) -lLLVM; -lLLVM"

type RemoveCvref[T any] struct {
}
type TypeIdentity[T any] struct {
}
type Identity struct {
}
type IdentityIsTransparent = c.Void
type FromRangeT struct {
}
type RemoveCvref[T any] struct {
}
type TypeIdentity[T any] struct {
}
4 changes: 2 additions & 2 deletions tool/gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func TestLLVM_Compiler(t *testing.T) {
testFromDir(t, "Compiler", "./_testcpp", true, "system")
}

func _TestLLVM_DenseMapInfo(t *testing.T) {
func TestLLVM_DenseMapInfo(t *testing.T) {
testFromDir(t, "DenseMapInfo", "./_testcpp", true, "adt")
}

Expand All @@ -334,6 +334,6 @@ func TestLLVM_iterator_range(t *testing.T) {
testFromDir(t, "iterator_range", "./_testcpp", true, "adt")
}

func _TestLLVM_STLForwardCompat(t *testing.T) {
func TestLLVM_STLForwardCompat(t *testing.T) {
testFromDir(t, "STLForwardCompat", "./_testcpp", true, "adt")
}
Loading