[PATCH] D158771: [clang][tooling] Fix `name` range-selector to handle TypeLocs correctly.

Eric Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 24 13:45:59 PDT 2023


li.zhe.hua accepted this revision.
li.zhe.hua added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/Tooling/Transformer/RangeSelector.cpp:239-240
+          !SpecLoc.isNull())
+        return CharSourceRange::getTokenRange(SpecLoc.getTemplateNameLoc(),
+                                              SpecLoc.getTemplateNameLoc());
       return CharSourceRange::getTokenRange(Loc.getSourceRange());
----------------
Optional: If the token range is only one token, you can specify a single location that is the start of the token.


================
Comment at: clang/unittests/Tooling/RangeSelectorTest.cpp:493
+    template <typename T>
+    struct Foo { T x; };
+    }  // namespace ns
----------------
Nit: Is the data member necessary?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158771/new/

https://reviews.llvm.org/D158771



More information about the cfe-commits mailing list