• Carlos Galvez's avatar
    [clang-tidy] Remove gsl::at suggestion from cppcoreguidelines-pro-bounds-constant-array-index · eb3f20e8
    Carlos Galvez authored
    Currently the fix hint is hardcoded to gsl::at(). This poses
    a problem for people who, for a number of reasons, don't want
    or cannot use the GSL library (introducing a new third-party
    dependency into a project is not a minor task).
    
    In these situations, the fix hint does more harm than good
    as it creates confusion as to what the fix should be. People
    can even misinterpret the fix "gsl::at" as e.g. "std::array::at",
    which can lead to even more trouble (e.g. when having guidelines
    that disallow exceptions).
    
    Furthermore, this is not a requirement from the C++ Core Guidelines.
    simply that array indexing needs to be safe. Each project should
    be able to decide upon a strategy for safe indexing.
    
    The fix-it is kept for people who want to use the GSL library.
    
    Differential Revision: https://reviews.llvm.org/D117857
    eb3f20e8
cppcoreguidelines-pro-bounds-constant-array-index-gslheader.cpp 2.72 KB