diff options
author | Matthias Springer <me@m-sp.org> | 2025-03-28 14:18:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-28 14:18:54 +0100 |
commit | 4abff4d7b2b49f343da68f32ffdae2914ba8ae7f (patch) | |
tree | 9a7f80f4a3444c1e6c2ed0b3a1234a424218ac48 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 33cd00f8c82d5df45b1dfd59310929a4d315fd8e (diff) | |
download | llvm-4abff4d7b2b49f343da68f32ffdae2914ba8ae7f.zip llvm-4abff4d7b2b49f343da68f32ffdae2914ba8ae7f.tar.gz llvm-4abff4d7b2b49f343da68f32ffdae2914ba8ae7f.tar.bz2 |
[mlir][Transforms] Improve `replaceOpWithMultiple` API (#132608)
This commit adds an additional overload to `replaceOpWithMultiple` that
accepts additional container types. This has been brought up by users of
the new `replaceOpWithMultiple` API.
In particular, one missing container type was
`SmallVector<SmallVector<Value>>`. The "default" `ArrayRef<ValueRange>`
container type can lead to use-after-scope errors in cases such as:
```c++
// Compute the replacement value ranges. Some replacements are single
// values, some are value ranges.
SmallVector<ValueRange> repl;
repl.push_back(someValueRange); // OK
for (...) {
// push_back(Value) triggers an implicit conversion to ValueRange,
// which does not own the range.
repl.push_back(someValue); // triggers use-after-scope later
}
rewriter.replaceOpWithMultiple(op, repl);
```
In this example, users should use `SmallVector<SmallVector<Value>>
repl;`.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions