diff options
author | Alex Voicu <alexandru.voicu@amd.com> | 2023-08-28 20:44:06 +0100 |
---|---|---|
committer | Alex Voicu <alexandru.voicu@amd.com> | 2023-08-28 20:44:06 +0100 |
commit | 9c760ca8ecfd570212b47a5e980d38575b879029 (patch) | |
tree | 1dbfcae018448791bdfeda8c3a6a17beb7b7541a /clang/unittests/Interpreter/CodeCompletionTest.cpp | |
parent | dd3aa26fc8e9de37a39611f7a6a602bcb4153784 (diff) | |
download | llvm-9c760ca8ecfd570212b47a5e980d38575b879029.zip llvm-9c760ca8ecfd570212b47a5e980d38575b879029.tar.gz llvm-9c760ca8ecfd570212b47a5e980d38575b879029.tar.bz2 |
[Clang][CodeGen] `typeid` needs special care when `type_info` is not in the default AS
After https://reviews.llvm.org/D153092, for targets that use a non-default AS for globals, an "interesting" situation arises around typeid and its paired type, type_info:
- on the AST level, the type_info interface is defined with default / generic addresses, be it for function arguments, or for this;
- in IR, type_info values are globals, and thus pointers to type_info values are pointers to global
This leads to a mismatch between the function signature / formal type of the argument, and its actual type. Currently we try to handle such mismatches via `bitcast`, but that is wrong in this case, since an `ascast` is required. This patch ensures that iff the pointer to `type_info` points to a non-default AS, an ascast is inserted so as to match the `typeid` interface / return value type.
Reviewed by: yaxunl
Differential Revision: https://reviews.llvm.org/D157452
Diffstat (limited to 'clang/unittests/Interpreter/CodeCompletionTest.cpp')
0 files changed, 0 insertions, 0 deletions