[PATCH] D42983: [clang-tidy] Add readability-simd-intrinsics check.

Tim Shen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 6 18:37:26 PST 2018


timshen added inline comments.


================
Comment at: clang-tidy/readability/SIMDIntrinsicsCheck.cpp:24
+  if (Name.startswith("vec_"))
+    Name = Name.substr(4);
+  else
----------------
timshen wrote:
> Can you either find or create a wrapper for this?
> 
>   bool StripPrefix(StringRef Prefix, StringRef& S) {
>     if (S.startwith(Prefix)) {
>       S = S.substr(Prefix.size());
>       return true;
>     }
>     return false;
>   }
> 
> Which is a huge readability boost and DRY.
Found it: StringRef::consume_front()


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D42983





More information about the cfe-commits mailing list