https://github.com/ArcsinX requested changes to this pull request.

There are still some cases which are not supported yet:
- extracting call to function reference
```cpp
void f(void (&F)(int)) { [[F(0);]] }
```
Produces `void extracted(void (const &F)(int))` and because of this `const`, 
this can't compile.

- two-dimension variable-length array in C
If a variable is used only in array bounds, it won't be added to extracted 
function parameters:
```c
void f(int N) { int A[2][N]; [[A[0][0] = 1;]] }
```
Produces `extracted(int (*A)[N])` (without `N` in parameters)

if we extract code with `N` modification, `N` will be passed by a pointer and 
produce signature which can't be compiled: `extracted(int *N, int (*A)[N])`

Also, in case of `N` modification, size of array at initialization will differ 
from `N` which will be used at code extraction.
```
int N = 2;
int A[2][N];  // Creates a 2×2 array.
N = 3;        // a remains 2×2.
... // code for extraction is here
```

I am not sure how hard is to fix these variable-length array in C problems, if 
it really hard, I think we can just return "too complex" for such cases

https://github.com/llvm/llvm-project/pull/230046
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to