diff options
author | flovent <flbven@protonmail.com> | 2025-06-25 22:15:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-25 16:15:01 +0200 |
commit | b8bda9d446e756f1ec722a06d604a654b472e581 (patch) | |
tree | 2067929167fee0982e7aba0d97f089bf020aade9 /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | 022e1e99f3b017ac1baf8b65f5a48212c5fca2ae (diff) | |
download | llvm-b8bda9d446e756f1ec722a06d604a654b472e581.zip llvm-b8bda9d446e756f1ec722a06d604a654b472e581.tar.gz llvm-b8bda9d446e756f1ec722a06d604a654b472e581.tar.bz2 |
[clang][analyzer] Correctly handle lambda-converted function pointers (#144906)
For lambdas that are converted to C function pointers,
```
int (*ret_zero)() = []() { return 0; };
```
clang will generate conversion method like:
```
CXXConversionDecl implicit used constexpr operator int (*)() 'int (*() const noexcept)()' inline
-CompoundStmt
-ReturnStmt
-ImplicitCastExpr 'int (*)()' <FunctionToPointerDecay>
-DeclRefExpr 'int ()' lvalue CXXMethod 0x5ddb6fe35b18 '__invoke' 'int ()'
-CXXMethodDecl implicit used __invoke 'int ()' static inline
-CompoundStmt (empty)
```
Based on comment in Sema, `__invoke`'s function body is left empty
because it's will be filled in CodeGen, so in AST analysis phase we
should get lambda's `operator()` directly instead of calling `__invoke`
itself.
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions