The Phantom Derpstorm
5989450e00
[clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) ( #68620 )
...
This commit implements the entirety of the now-accepted [N3017 -
Preprocessor
Embed](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm ) and
its sister C++ paper [p1967](https://wg21.link/p1967 ). It implements
everything in the specification, and includes an implementation that
drastically improves the time it takes to embed data in specific
scenarios (the initialization of character type arrays). The mechanisms
used to do this are used under the "as-if" rule, and in general when the
system cannot detect it is initializing an array object in a variable
declaration, will generate EmbedExpr AST node which will be expanded
by AST consumers (CodeGen or constant expression evaluators) or
expand embed directive as a comma expression.
---------
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Co-authored-by: cor3ntin <corentinjabot@gmail.com>
Co-authored-by: H. Vetinari <h.vetinari@gmx.com>
Co-authored-by: Podchishchaeva, Mariya <mariya.podchishchaeva@intel.com>
2024-06-12 09:16:02 +02:00
Timm Bäder
93d4fb032e
[clang][Interp] Support floats in APValues
2024-06-12 08:15:36 +02:00
Timm Bäder
4cf607fa15
[clang][Interp] Fix visiting non-FieldDecl MemberExprs
...
Ignore the base and visit the Member decl like a regular DeclRefExpr.
2024-06-11 18:13:28 +02:00
Timm Bäder
e805b77107
[clang][Interp] Support ObjCEncodeExprs
2024-06-11 15:07:28 +02:00
Timm Bäder
529b43c1fd
[clang][Interp] Refine diagnostics for casts from void*
...
This is still not perfect, but an improvement in general.
2024-06-11 11:19:06 +02:00
Timm Bäder
c0b65a2491
[clang][Interp] Diagnose casts from void pointers
2024-06-10 10:18:57 +02:00
Timm Bäder
5bb9c08d88
[clang][Interp] Reject compound assign operators pre-C++14
2024-06-09 14:58:21 +02:00
Timm Bäder
69cd2d288d
[clang][Interp] Handle __extension__ for complex values
2024-06-09 14:29:12 +02:00
Timm Bäder
cb8e9360d8
[clang][Interp] Implement ~ operator for complex values
2024-06-09 14:29:12 +02:00
Timm Bäder
b8cc85b318
[clang][Interp] Limit lambda capture lazy visting to actual captures
...
Check this by looking at the VarDecl.
2024-06-07 13:29:23 +02:00
Timm Bäder
3a31eaeac8
[clang][Interp] Fix refers_to_enclosing_variable_or_capture DREs
...
They do not count into lambda captures, so visit them lazily.
2024-06-07 11:48:44 +02:00
Timm Bäder
c15b86731b
[clang][Interp][NFC] Add GetPtrFieldPop opcode
...
And change the previous GetPtrField to only peek() the base pointer.
We can get rid of a whole bunch of DupPtr ops this way.
2024-06-07 09:40:26 +02:00
Timm Bäder
0b8acc06c4
[clang][Interp] Improve APValue machinery
...
Handle lvalues pointing to declarations, unions and member pointers.
2024-06-07 08:16:39 +02:00
Timm Baeder
a86c1e7175
[clang][Interp] Member Pointers ( #91303 )
...
This adds a `MemberPointer` class along with a `PT_MemberPtr` primitive
type.
A `MemberPointer` has a `Pointer` Base as well as a `Decl*` (could be
`ValueDecl*`?) decl it points to.
For the actual logic, this mainly changes the way we handle `PtrMemOp`s
in `VisitBinaryOperator`.
2024-06-06 11:17:48 +02:00
Timm Bäder
f1e78f7769
[clang][Interp] Handle lvalue APValues in visitAPValueInitializer()
2024-06-06 10:24:26 +02:00
Timm Bäder
1ea568895a
[clang][Interp][NFC] Mark failed globals as uninitialized
...
This happens automatically if anything _before_ the Ret op fails,
but in this case we have to un-initialize it again.
2024-06-05 13:10:18 +02:00
Timm Bäder
49b760ff2c
[clang][Interp] Fix calling virtual CXXOperatorCallExprs
2024-05-27 16:01:30 +02:00
Timm Bäder
6a197b35db
[clang][Interp] Fix returning references to functions
...
Previously, we pushed a pointer to the stack and later tried to use
it as if it was a function pointer, which doesn't work.
2024-05-27 15:43:12 +02:00
Timm Bäder
4447461bc4
[clang][Interp] Don't try to dereference a null type
2024-05-27 12:59:25 +02:00
Timm Bäder
d0bb917390
[clang][Interp] Handle ObjCBoxedExprs
2024-05-26 10:50:45 +02:00
Timm Bäder
5220b7bea8
[clang][Interp] Handle objc strings
2024-05-26 10:50:44 +02:00
Timm Bäder
5c40db1da3
[clang][Interp] Don't retry weak declarations
2024-05-24 20:00:54 +02:00
Timm Bäder
f35aac6991
[clang][Interp] Fix zero-initializing unions
...
Only with primitive fields for now.
2024-05-24 15:15:40 +02:00
Timm Bäder
45a95c3c54
[clang][Interp] Fix DeclRefExprs of void-typed dummy pointers
2024-05-23 11:56:23 +02:00
Timm Bäder
10dc3a8e91
[clang][Interp] Fix empty InitListExprs for unions
...
We still need to handle Inits.size() == 0, but we can do that earlier.
2024-05-23 11:48:33 +02:00
Timm Bäder
af6812085c
[clang][Interp] Fix initializing a union from an InitLIstExpr
...
We can't just count the field to initialize but need to consult the
InitListExpr to give us the right field.
2024-05-23 09:17:56 +02:00
Timm Bäder
4fbc95d136
[clang][Interp] Skip union members in default initializers
2024-05-22 17:57:00 +02:00
Timm Bäder
18e7bcbae1
[clang][Interp] Reject inc/dec ops before C++ 14
2024-05-21 13:20:42 +02:00
Timm Bäder
a7521fd162
[clang][Interp] Implement __builtin_sycl_unique_stable_name
2024-05-21 13:20:42 +02:00
Timm Bäder
d9c27cafdb
[clang][Interp] Fix discarding construct exprs with zero initializers
...
We need to create the temporary earlier so the
visitZeroRecordInitializer() call has access to it.
2024-05-21 12:51:30 +02:00
Timm Bäder
808fc84069
[clang][Interp] Fix dummy DeclRefExprs for function pointers
2024-05-21 12:02:19 +02:00
Timm Bäder
9d70975c7a
[clang][Interp][NFC] Remove an assertion that's too strong
...
Both types need to boil down to a vector type with the same length
and their element types need to match, but we still can't compare
them with == since they might be sugared, etc.
2024-05-21 11:38:45 +02:00
Timm Bäder
45cc6bdea9
[clang][Interp] Implement __builtin_shufflevector
2024-05-16 08:26:59 +02:00
Timm Bäder
74218a9c8f
[clang][Interp] Implement __builtin_convertvector
2024-05-15 17:40:48 +02:00
Timm Bäder
413aaf11cd
[clang][Interp][NFC] Support IntAP(S) in emitPrimCast
2024-05-15 17:12:41 +02:00
Timm Bäder
afba3daf82
[clang][Interp] Add basic support for AddrLabelExprs
...
Just create a local variable for them.
2024-05-15 10:17:10 +02:00
Timm Bäder
257013e4f5
[clang][Interp] Handle VariableArrayTypes
2024-05-13 17:21:39 +02:00
Timm Bäder
67c18721eb
[clang][Interp] Return false from visitExpr() if allocateLocal failed
2024-05-13 16:59:30 +02:00
Timm Bäder
9a521e274d
[clang][Interp] Fix primitive lambda capture defaults
...
We need to use InitField here, not SetField.
2024-05-06 10:37:30 +02:00
Timm Bäder
aac588abfa
Reapply "[clang][Interp] Fix locals created in ExprWithCleanups"
...
This reverts commit 427c5bfd39ebb9d008b621370579444fbf2a60d7.
2024-05-02 16:56:38 +02:00
Timm Bäder
7dfb6f571c
[clang][Interp] Fix ignored RequiresExprs
...
Also ConceptSpecializationExpr, although I don't have a test case
at hand for those.
2024-05-02 15:47:15 +02:00
Timm Bäder
427c5bfd39
Revert "[clang][Interp] Fix locals created in ExprWithCleanups"
...
This reverts commit 1c7673b91d4d3bab4e296f5c67751d3879fb21a2.
Unfortunately, this one is broken because de04e6cd90b891215f1dfc83ec886d037a7c2ed0
has been reverted.
2024-05-02 14:03:48 +02:00
Timm Bäder
1c7673b91d
[clang][Interp] Fix locals created in ExprWithCleanups
...
Save the declaration we're creating a scope for (if applicable),
so we can attach a local temporary variable to the right scope.
2024-05-02 13:51:50 +02:00
Timm Bäder
e5fb656435
[clang][Interp] Handle RecoveryExprs
...
Instead of checking containsErrors() for every expression, just handle
RecoveryExprs directly.
2024-05-02 13:43:06 +02:00
Timm Bäder
5d9889a6c6
[clang][Interp] Fix zero-initializing records with non-trivial ctors
...
We need to do the zero-init and then subsequently call the constructor.
2024-05-02 13:20:04 +02:00
Timm Bäder
af5d41e0ca
[clang][Interp] Support CXXScalarValueInitExprs of vector type
2024-04-30 12:41:14 +02:00
Timm Bäder
2f9462e9e4
[clang][Interp] Fix initializing vectors from a list of other vectors
2024-04-30 12:41:14 +02:00
Timm Bäder
3590ede848
[clang][Interp] Support vec_step
2024-04-29 18:21:24 +02:00
Timm Bäder
45bd85e481
[clang][Interp] Fix casting function pointers to integers
2024-04-29 16:33:21 +02:00
Timm Bäder
e34b41c707
[clang][Interp] Support CXXParenListInitExprs for non-record types
...
Merge the non-record code paths into visitInitList().
2024-04-29 16:30:13 +02:00