[PATCH] D134733: [clang-format][NFC] more centric handling of include name matching

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 6 14:02:52 PDT 2022


owenpan added a comment.

Can you rebase? I'll finish the review after that.



================
Comment at: clang/lib/Tooling/Inclusions/HeaderIncludes.cpp:410
+llvm::StringRef getIncludeNameFromMatches(
+    const llvm::SmallVectorImpl<llvm::StringRef> &Matches) {
+  if (Matches.size() >= 3) {
----------------
Use `ArrayRef` instead.


================
Comment at: clang/lib/Tooling/Inclusions/HeaderIncludes.cpp:411-415
+  if (Matches.size() >= 3) {
+    return Matches[2];
+  }
+  llvm_unreachable("Matches is too small");
+  return llvm::StringRef();
----------------
You can simply assert and return.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134733



More information about the cfe-commits mailing list