summaryrefslogtreecommitdiff
path: root/clang/test/AST/ByteCode/functions.cpp
AgeCommit message (Collapse)Author
2025-09-19[clang][bytecode] Typecheck called function pointers more thorougly (#159757)Timm Baeder
Fix two older FIXME items from the `functions.cpp` test.
2025-08-21[clang][bytecode] Implement Pointer::getType() for function pointers (#154788)Timm Baeder
Fixes #152920
2025-08-16[clang][bytecode] Prefer ParmVarDecls as function parameters (#153952)Timm Baeder
We might create a local temporary variable for a ParmVarDecl, in which case a DeclRefExpr for that ParmVarDecl should _still_ result in us choosing the parameter, not that local.
2025-08-09[clang][bytecode] Use visitExpr() in interpretCall (#152857)Timm Baeder
This is the correct function to use and it will create a variable scope. Fixes #152822
2025-08-06[clang][ExprConst] Consider integer pointers of value 0 nullptr (#150164)Timm Baeder
When casting a 0 to a pointer type, the IsNullPtr flag was always set to false, leading to weird results like a pointer with value 0 that isn't a null pointer. This caused ```c++ struct B { const int *p;}; template<B> void f() {} template void f<B{nullptr}>(); template void f<B{fold(reinterpret_cast<int*>(0))}>(); ``` to be valid code, since nullptr and (int*)0 aren't equal. This seems weird and GCC doesn't behave like this.
2025-07-30[clang] Forbid reinterpret_cast of function pointers in constexpr. (#150557)Eli Friedman
This has been explicitly forbidden since C++11, but somehow the edge case of converting a function pointer to void* using a cast like `(void*)f` wasn't handled. Fixes #150340 .
2025-07-08[Clang] include attribute scope in diagnostics (#144619)Oleksandr T.
This patch updates diagnostics to print fully qualified attribute names, including scope when present.
2025-03-05[clang][bytecode] Ignore function calls with depth > 0... (#129887)Timm Baeder
... when checking for a potential constant expression. This is also what the current interpreter does.
2025-03-04[clang][bytecode] Only emit literal_comparison for string literals (#129691)Timm Baeder
This is what the current interpreter does as well.
2025-01-09[clang][ExprConst] Add diagnostics for invalid binary arithmetic (#118475)Timm Baeder
... between unrelated declarations or literals. Leaving this small (I haven't run the whole test suite locally) to get some feedback on the wording and implementation first. The output of the sample in https://github.com/llvm/llvm-project/issues/117409 is now: ```console ./array.cpp:57:6: warning: expression result unused [-Wunused-value] 57 | am - aj.af(); | ~~ ^ ~~~~~~~ ./array.cpp:70:8: error: call to consteval function 'L::L<bx>' is not a constant expression 70 | q(0, [] { | ^ ./array.cpp:57:6: note: arithmetic on addresses of literals has unspecified value 57 | am - aj.af(); | ^ ./array.cpp:62:5: note: in call to 'al(&""[0], {&""[0]})' 62 | al(bp.af(), k); | ^~~~~~~~~~~~~~ ./array.cpp:70:8: note: in call to 'L<bx>({})' 70 | q(0, [] { | ^~~~ 71 | struct bx { | ~~~~~~~~~~~ 72 | constexpr operator ab<g<l<decltype(""[0])>::e>::e>() { return t(""); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | }; | ~~ 74 | return bx(); | ~~~~~~~~~~~~ 75 | }()); | ~~~ ``` The output for ```c++ int a, b; constexpr int n = &b - &a ``` is now: ```console ./array.cpp:80:15: error: constexpr variable 'n' must be initialized by a constant expression 80 | constexpr int n = &b - &a; | ^ ~~~~~~~ ./array.cpp:80:22: note: arithmetic involving '&b' and '&a' has unspecified value 80 | constexpr int n = &b - &a; | ^ 1 error generated. ```
2024-12-17[clang][bytecode] Don't check returned pointers for liveness (#120107)Timm Baeder
We're supposed to let them through and then later diagnose reading from them, but returning dead pointers is fine.
2024-08-16[clang] Rename all AST/Interp stuff to AST/ByteCode (#104552)Timm Baeder
"Interp" clashes with the clang interpreter and people often confuse this.