[PATCH] D132727: [clang][Interp] Implement array initializers and subscript expressions
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 29 08:18:21 PDT 2022
aaron.ballman added a comment.
Precommit CI found a relevant failure:
FAIL: Clang :: AST/Interp/arrays.cpp (67 of 15858)
******************** TEST 'Clang :: AST/Interp/arrays.cpp' FAILED ********************
Script:
--
: 'RUN: at line 1'; c:\ws\w5\llvm-project\premerge-checks\build\bin\clang.exe -cc1 -internal-isystem c:\ws\w5\llvm-project\premerge-checks\build\lib\clang\16.0.0\include -nostdsysteminc -fexperimental-new-constant-interpreter -verify C:\ws\w5\llvm-project\premerge-checks\clang\test\AST\Interp\arrays.cpp
: 'RUN: at line 2'; c:\ws\w5\llvm-project\premerge-checks\build\bin\clang.exe -cc1 -internal-isystem c:\ws\w5\llvm-project\premerge-checks\build\lib\clang\16.0.0\include -nostdsysteminc -verify=ref C:\ws\w5\llvm-project\premerge-checks\clang\test\AST\Interp\arrays.cpp
--
Exit Code: 1
Command Output (stdout):
--
$ ":" "RUN: at line 1"
$ "c:\ws\w5\llvm-project\premerge-checks\build\bin\clang.exe" "-cc1" "-internal-isystem" "c:\ws\w5\llvm-project\premerge-checks\build\lib\clang\16.0.0\include" "-nostdsysteminc" "-fexperimental-new-constant-interpreter" "-verify" "C:\ws\w5\llvm-project\premerge-checks\clang\test\AST\Interp\arrays.cpp"
# command stderr:
error: 'note' diagnostics expected but not seen:
File C:\ws\w5\llvm-project\premerge-checks\clang\test\AST\Interp\arrays.cpp Line 49: 5 == 4
1 error generated.
error: command failed with exit status: 1
--
********************
================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.h:43
protected:
- // Emitters for opcodes of various arities.
- using NullaryFn = bool (ByteCodeExprGen::*)(const SourceInfo &);
- using UnaryFn = bool (ByteCodeExprGen::*)(PrimType, const SourceInfo &);
- using BinaryFn = bool (ByteCodeExprGen::*)(PrimType, PrimType,
- const SourceInfo &);
-
- // Aliases for types defined in the emitter.
- using LabelTy = typename Emitter::LabelTy;
- using AddrTy = typename Emitter::AddrTy;
-
- // Reference to a function generating the pointer of an initialized object.s
+ // Reference to a function generating the pointer of an initialized object.
using InitFnRef = std::function<bool()>;
----------------
tbaeder wrote:
> Yes, a few of these cleanups, renames and added doc comments aren't necessary for this patch. I will remove them if you want to, I just don't want to rebase against `main` all the time to push NFC patches.
Please remove them; we want to keep changes logically separate per our developer policy. The biggest reason is: we sometimes need to revert changes and there's no reason to lose the good (unrelated) work at the same time, but also, it helps code reviewers to focus on the important parts without getting lost tracking which changes are for what reason.
================
Comment at: clang/test/AST/Interp/arrays.cpp:10
+};
+
+static_assert(foo[0][0] == nullptr, "");
----------------
I'd like to see a test for designated initialization of arrays, including reinitialization: https://godbolt.org/z/xfjW8xPfE
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132727/new/
https://reviews.llvm.org/D132727
More information about the cfe-commits
mailing list