alibaba / alibaba/fastFFI

[Bug] Unsupported function is skiped sliently by the binding-generator

Open
#10 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
127
Forks
14
PR merge metrics
No merged PRs in 30d

Description

For following code

```cpp
#pragma once

template
class reverse_iterator {
};

template
class basic_string_view
{
public:
typedef CharT const * const_pointer;
typedef const_pointer const_iterator;

typedef reverse_iterator< CharT > const_reverse_iterator;

const_reverse_iterator begin() const {
return const_reverse_iterator{};
}
};
```

The binding-generator generates

```java
Build fastffi.reverse_iterator@762218386
package fastffi;

import com.alibaba.fastffi.CXXHead;
import com.alibaba.fastffi.FFIGen;
import com.alibaba.fastffi.FFIPointer;
import com.alibaba.fastffi.FFITypeAlias;

@FFITypeAlias("reverse_iterator")
@FFIGen
@CXXHead("basic/ds/stringview.vineyard-mod")
public interface reverse_iterator extends FFIPointer {
}

Build fastffi.basic_string_view@1551870003
package fastffi;

import com.alibaba.fastffi.CXXHead;
import com.alibaba.fastffi.FFIGen;
import com.alibaba.fastffi.FFIPointer;
import com.alibaba.fastffi.FFITypeAlias;

@FFITypeAlias("basic_string_view")
@FFIGen
@CXXHead("basic/ds/stringview.vineyard-mod")
public interface basic_string_view extends FFIPointer {
}
```

Note that the `begin()` method is skiped and it would occur if we change the return type of `begin()` to `int`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the provided C++ templates and run the binding-generator to compare the generated output for begin() returning const_reverse_iterator versus int. Inspect the binding-generator path that handles unsupported function return types. Done means the unsupported begin() case is no longer silently skipped and its behavior is covered or clearly reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.