20 Commits

Author SHA1 Message Date
Timm Baeder
c51d396f4d
[clang][bytecode] Fix __builtin_memmove type diagnostics (#132544)
Set the source type when allocating primitives so we can later retrieve
it.
2025-03-22 14:58:32 +01:00
Kazu Hirata
c38ef58557
[ByteCode] Avoid repeated hash lookups (NFC) (#132141) 2025-03-20 09:09:57 -07:00
Timm Baeder
06fc7d68ff
[clang][bytecode] Don't error out on incomplete declarations (#129685)
Later operations on these are invalid, but the declaration is fine, if
extern.
2025-03-04 12:41:34 +01:00
Timm Baeder
2c1e9f14be
[clang][bytecode] Explicit composite array descriptor types (#129376)
When creating descriptor for array element types, we only save the
original source, e.g. int[2][2][2]. So later calls to getType() of the
element descriptors will also return int[2][2][2], instead of e.g.
int[2][2] for the second dimension.
Fix this by explicitly tracking the array types.
The last attached test case used to have an lvalue offset of 32 instead
of 24.

We should do this for more desriptor types though and not just composite
array, but I'm leaving that to a later patch.
2025-03-02 09:40:56 +01:00
Timm Baeder
e8d848824b
[clang][bytecode] Fix dynamic array allocation return values (#127387)
We need to return a pointer to the first element, not the array itself.
2025-02-16 12:24:35 +01:00
Kazu Hirata
2fee5ef235
[ByteCode] Avoid repeated hash lookups (NFC) (#126379) 2025-02-08 11:35:45 -08:00
Timm Baeder
f7f3dfce3d
[clang][bytecode] Refactor Program::createGlobalString (#125467)
Remove unnecesary narrow() calls, rename a variable and initialize the
array as a whole instead of each element individually.
2025-02-03 09:42:12 +01:00
Timm Baeder
a34a087fc5
[clang][bytecode] Handle non-primitive vector element types (#124926)
By rejecting them. We would crash before.
2025-01-29 16:39:02 +01:00
Kazu Hirata
80e0cbafba
[ByteCode] Migrate away from PointerUnion::dyn_cast (NFC) (#123445)
Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:

  // FIXME: Replace the uses of is(), get() and dyn_cast() with
  //        isa<T>, cast<T> and the llvm::dyn_cast<T>

Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we expect D to be nonnull.
2025-01-18 09:43:17 -08:00
Kazu Hirata
63d9ef5e37
[AST] Migrate away from PointerUnion::{is,get} (NFC) (#117469)
Note that PointerUnion::{is,get} have been soft deprecated in
PointerUnion.h:

  // FIXME: Replace the uses of is(), get() and dyn_cast() with
  //        isa<T>, cast<T> and the llvm::dyn_cast<T>

I'm not touching PointerUnion::dyn_cast for now because it's a bit
complicated; we could blindly migrate it to dyn_cast_if_present, but
we should probably use dyn_cast when the operand is known to be
non-null.
2024-11-24 07:28:20 -08:00
Kazu Hirata
dec6324cb0
[AST] Remove unused includes (NFC) (#116549)
Identified with misc-include-cleaner.
2024-11-17 09:36:48 -08:00
Timm Baeder
05910b44c9
[clang][bytecode][NFC] Use const auto* for Type cast result (#114405) 2024-10-31 16:37:53 +01:00
Timm Baeder
9ae41c24b3
[clang][bytecode] Create dummy pointers for non-reference DeclRefExprs (#113202)
... with non-constant initializers.
2024-10-22 10:38:13 +02:00
Timm Baeder
ff04bb8f40
[clang][bytecode] Use PredefinedExpr as base for its variable (#111956)
This fixes the error message generated.
2024-10-11 09:31:49 +02:00
Kazu Hirata
93f7fce397
[ByteCode] Avoid repeated hash lookups (NFC) (#111273) 2024-10-06 09:22:13 -07:00
Timm Baeder
4e5f8a8f0b
[clang][bytecode] Save a per-Block IsWeak bit (#111248)
Checking the decl for every load is rather expensive.
2024-10-05 17:35:52 +02:00
Timm Baeder
8e2dbab242
[clang][bytecode] Fix defining extern variables (#108940)
At the point of defintion of the variable, a function might already
refert to the variable by its index. Replace the index with the new one.
2024-09-17 15:21:28 +02:00
Timm Baeder
bd8d432d7b
[clang][bytecode] Add support for creating dummies for expressions (#108394)
And use that to fix VisitObjCBoxedExprs.
2024-09-12 17:25:40 +02:00
Timm Baeder
3e999bbc2d
[clang][bytecode] Use first FieldDecl instead of asserting (#104760)
This assertion fails sometimes. We use the first decl for lookup later,
so let's use the first decl here as well.
2024-08-19 15:14:44 +02:00
Timm Baeder
a07aba5d44
[clang] Rename all AST/Interp stuff to AST/ByteCode (#104552)
"Interp" clashes with the clang interpreter and people often confuse
this.
2024-08-16 17:13:12 +02:00