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); 
}
 


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); }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D73541: [Cl... Nathan James via Phabricator via cfe-commits

Reply via email to