[PATCH] D17772: [clang-tidy]: string_view of temporary string

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 1 10:04:44 PST 2016


alexfh added a comment.

As David noted, there are other similar classes like `llvm::StringRef`, `llvm::ArraryRef`, `gsl::span`, `StringPiece` (in various Google projects, e.g. https://github.com/google/re2/blob/master/re2/stringpiece.h) and numerous other in different code bases. I think, we should make the check sufficiently configurable to be able to support other similar classes.


================
Comment at: clang-tidy/misc/MiscTidyModule.cpp:36
@@ -34,2 +35,2 @@
 #include "SwappedArgumentsCheck.h"
 #include "ThrowByValueCatchByReferenceCheck.h"
----------------
Please include the full context in the diff (see http://llvm.org/docs/Phabricator.html).

================
Comment at: clang-tidy/misc/MiscTidyModule.cpp:89
@@ -87,1 +88,3 @@
         "misc-string-integer-assignment");
+    CheckFactories.registerCheck<String_viewOfTemporaryCheck>(
+        "misc-string_view-of-temporary");
----------------
Please use CamelCase for class names: `StringViewOfTemporaryCheck`.

================
Comment at: clang-tidy/misc/MiscTidyModule.cpp:90
@@ -88,1 +89,3 @@
+    CheckFactories.registerCheck<String_viewOfTemporaryCheck>(
+        "misc-string_view-of-temporary");
     CheckFactories.registerCheck<SuspiciousSemicolonCheck>(
----------------
Please only use dashes as delimiters in the check name: `misc-string-view-of-temporary`.


Repository:
  rL LLVM

http://reviews.llvm.org/D17772





More information about the cfe-commits mailing list