================
@@ -437,3 +438,17 @@ RangeSelector transformer::expansion(RangeSelector S) {
     return Result.SourceManager->getExpansionRange(*SRange);
   };
 }
+
+RangeSelector transformer::spelled(RangeSelector S) {
+  return [S](const MatchResult &Result) -> Expected<CharSourceRange> {
+    Expected<CharSourceRange> SRange = S(Result);
+    if (!SRange)
+      return SRange.takeError();
+    const auto &SM = *Result.SourceManager;
+    const auto B = SRange->getBegin();
+    const auto E = SRange->getEnd();
+    return CharSourceRange(
+        SourceRange(SM.getSpellingLoc(B), SM.getSpellingLoc(E)),
+        SRange->isTokenRange());
----------------
ymand wrote:

In your comments, you mention that char ranges won't work (which I agree with). 
Given that, please update this code to explicitly reject them and add a 
corresponding test.

https://github.com/llvm/llvm-project/pull/177442
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to