njames93 added inline comments.

================
Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp:26
+                                        utils::IncludeSorter::IS_LLVM)),
+      FixHint(Options.get("FixHint", "gsl::at()")) {}
 
----------------
Should elide the braces here for the option and insert them at the warning 
stage.


================
Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp:79-82
     auto Diag = diag(Matched->getExprLoc(),
-                     "do not use array subscript when the index is "
-                     "not an integer constant expression; use gsl::at() "
-                     "instead");
-    if (!GslHeader.empty()) {
+                     std::string("do not use array subscript when the index is 
"
+                                 "not an integer constant expression; use ") +
+                         FixHint + " instead");
----------------



================
Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp:84
+
+    if (!GslHeader.empty() && (FixHint == "gsl::at()")) {
       Diag << FixItHint::CreateInsertion(BaseRange.getBegin(), "gsl::at(")
----------------
This restriction on only offering a fix if using `gsl::at` seem a little too 
restrictive, especially when you factor that the GslHeader is defaulted to an 
empty string and that is already required for a fix to be emitted.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117205

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to