[PATCH] D78600: DenseStringElementsAttr added to default attribute types
Rob Suderman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 14:07:46 PDT 2020
rsuderman updated this revision to Diff 259704.
rsuderman marked 9 inline comments as done.
rsuderman added a comment.
Tweaked iterator behavior.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78600/new/
https://reviews.llvm.org/D78600
Files:
mlir/include/mlir/IR/Attributes.h
mlir/lib/IR/AsmPrinter.cpp
Index: mlir/lib/IR/AsmPrinter.cpp
===================================================================
--- mlir/lib/IR/AsmPrinter.cpp
+++ mlir/lib/IR/AsmPrinter.cpp
@@ -1471,7 +1471,7 @@
static void printDenseStringElement(DenseStringElementsAttr attr,
raw_ostream &os, unsigned index) {
os << "\"";
- printEscapedString(attr.getStringValues()[index], os);
+ printEscapedString(attr.getStringRefs()[index], os);
os << "\"";
}
Index: mlir/include/mlir/IR/Attributes.h
===================================================================
--- mlir/include/mlir/IR/Attributes.h
+++ mlir/include/mlir/IR/Attributes.h
@@ -887,9 +887,12 @@
ElementIterator<T>(rawData, splat, getNumElements())};
}
- llvm::iterator_range<ArrayRef<StringRef>::iterator> getValues() const {
- auto stringRefs = getStringValues();
- return {stringRefs.begin(), stringRefs.end()};
+ llvm::iterator_range<ElementIterator<StringRef>> getValues() const {
+ auto stringRefs = getStringRefs();
+ const char *ptr = reinterpret_cast<const char *>(stringRefs.data());
+ bool splat = isSplat();
+ return {ElementIterator<StringRef>(ptr, splat, 0),
+ ElementIterator<StringRef>(ptr, splat, getNumElements())};
}
/// Return the held element values as a range of Attributes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78600.259704.patch
Type: text/x-patch
Size: 1338 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200423/349d9400/attachment.bin>
More information about the llvm-commits
mailing list