[PATCH] D73541: [Clang] Added method getTokenLocations to StringLiteral
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 28 03:55:32 PST 2020
njames93 created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
njames93 edited the summary of this revision.
njames93 edited the summary of this revision.
njames93 added a reviewer: rsmith.
Adds a helper method `ArrayRef<SourceLocation> getTokenLocations() const` to `clang::StringLiteral` for easier analysis on the pieces that make up a string.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73541
Files:
clang/include/clang/AST/Expr.h
Index: clang/include/clang/AST/Expr.h
===================================================================
--- clang/include/clang/AST/Expr.h
+++ clang/include/clang/AST/Expr.h
@@ -1883,6 +1883,11 @@
return getTrailingObjects<SourceLocation>() + getNumConcatenated();
}
+ /// Gets the source location of each piece that makes up this string literal.
+ ArrayRef<SourceLocation> getTokenLocations() const {
+ return {getTrailingObjects<SourceLocation>(), getNumConcatenated()};
+ }
+
SourceLocation getBeginLoc() const LLVM_READONLY { return *tokloc_begin(); }
SourceLocation getEndLoc() const LLVM_READONLY { return *(tokloc_end() - 1); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73541.240831.patch
Type: text/x-patch
Size: 661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200128/7d5dd3c5/attachment.bin>
More information about the cfe-commits
mailing list