This project is mirrored from https://github.com/llvm-doe-org/llvm-project.git. Pull mirroring updated .
  1. 23 Jan, 2022 1 commit
    • 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
  2. 06 Aug, 2021 3 commits
  3. 11 Jun, 2021 1 commit
    • Simon Pilgrim's avatar
      [ADT] Remove APInt/APSInt toString() std::string variants · 61cdaf66
      Simon Pilgrim authored
      <string> is currently the highest impact header in a clang+llvm build:
      
      https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html
      
      One of the most common places this is being included is the APInt.h header, which needs it for an old toString() implementation that returns std::string - an inefficient method compared to the SmallString versions that it actually wraps.
      
      This patch replaces these APInt/APSInt methods with a pair of llvm::toString() helpers inside StringExtras.h, adjusts users accordingly and removes the <string> from APInt.h - I was hoping that more of these users could be converted to use the SmallString methods, but it appears that most end up creating a std::string anyhow. I avoided trying to use the raw_ostream << operators as well as I didn't want to lose having the integer radix explicit in the code.
      
      Differential Revision: https://reviews.llvm.org/D103888
      61cdaf66
  4. 28 Sep, 2020 1 commit
  5. 27 Jul, 2020 1 commit
    • Nathan James's avatar
      [clang-tidy] Refactor IncludeInserter · 13c9bbc2
      Nathan James authored
      Simplified how `IncludeInserter` is used in Checks by abstracting away the SourceManager and PPCallbacks inside the method `registerPreprocessor`.
      Changed checks that use `IncludeInserter` to no longer use a `std::unique_ptr`, instead the IncludeInserter is just a member of the class thats initialized with an `IncludeStyle`.
      Saving an unnecessary allocation.
      
      This results in the removal of the field `IncludeSorter::IncludeStyle` from the checks, as its wrapped in the `IncludeInserter`.
      No longer need to create an instance of the `IncludeInserter` in the registerPPCallbacks, now that method only needs to contain:
      ```
      Inserter.registerPreprocessor(PP);
      ```
      Also added a helper method to `IncludeInserter` called `createMainFileInclusionInsertion`, purely sugar but does better express intentions.
      
      Reviewed By: aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D83680
      13c9bbc2
  6. 22 Jul, 2020 1 commit
  7. 11 Jul, 2020 1 commit
  8. 29 Jun, 2020 3 commits
  9. 28 Jun, 2020 1 commit
  10. 07 Apr, 2020 1 commit
  11. 10 Mar, 2020 1 commit
  12. 03 Mar, 2020 1 commit
  13. 14 Aug, 2019 1 commit
  14. 22 Mar, 2019 1 commit
  15. 19 Jan, 2019 1 commit
    • Chandler Carruth's avatar
      Update the file headers across all of the LLVM projects in the monorepo · 2946cd70
      Chandler Carruth authored
      to reflect the new license.
      
      We understand that people may be surprised that we're moving the header
      entirely to discuss the new license. We checked this carefully with the
      Foundation's lawyer and we believe this is the correct approach.
      
      Essentially, all code in the project is now made available by the LLVM
      project under our new license, so you will see that the license headers
      include that license only. Some of our contributors have contributed
      code under our old license, and accordingly, we have retained a copy of
      our old license notice in the top-level files in each project and
      repository.
      
      llvm-svn: 351636
      2946cd70
  16. 09 Aug, 2018 1 commit
  17. 20 Jul, 2017 1 commit
  18. 08 Nov, 2016 1 commit
  19. 19 Jul, 2016 1 commit
    • Matthias Gehre's avatar
      cppcoreguidelines-pro-bounds-constant-array-index: ignore implicit constructor · dd117cf0
      Matthias Gehre authored
      Summary:
      The code
      
        struct A {
          int x[3];
        };
      
      gets an compiler-generated copy constructor that uses ArraySubscriptExpr (see below).
      Previously, the check would generate a warning on that copy constructor.
      This commit disables the warning on implicitly generated code.
      AST:
      
        |-CXXConstructorDecl 0x337b3c8 <col:8> col:8 implicit used constexpr A 'void (const struct A &) noexcept' inline
        | |-ParmVarDecl 0x337b510 <col:8> col:8 used 'const struct A &'
        | |-CXXCtorInitializer Field 0x3379238 'x' 'int [3]'
        | | `-ImplicitCastExpr 0x337e158 <col:8> 'int' <LValueToRValue>
        | |   `-ArraySubscriptExpr 0x337e130 <col:8> 'const int' lvalue
        | |     |-ImplicitCastExpr 0x337e118 <col:8> 'const int *' <ArrayToPointerDecay>
        | |     | `-MemberExpr 0x337dfc8 <col:8> 'int const[3]' lvalue .x 0x3379238
        | |     |   `-DeclRefExpr 0x337dfa0 <col:8> 'const struct A' lvalue ParmVar 0x337b510 '' 'const struct A &'
        | |     `-ImplicitCastExpr 0x337e098 <col:8> 'unsigned long' <LValueToRValue>
        | |       `-DeclRefExpr 0x337e070 <col:8> 'unsigned long' lvalue Var 0x337e010 '__i0' 'unsigned long'
      
      Reviewers: alexfh, aaron.ballman
      
      Subscribers: aemerson, nemanjai, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D22381
      
      llvm-svn: 275993
      dd117cf0
  20. 14 Jul, 2016 1 commit
    • Matthias Gehre's avatar
      cppcoreguidelines-pro-bounds-constant-array-index: crash for value dependent index in c++03 mode · 03fadabe
      Matthias Gehre authored
      Summary:
      When the expression is value dependent,
      isIntegerConstantExpr() crashes in C++03 mode with
       ../tools/clang/lib/AST/ExprConstant.cpp:9330: (anonymous namespace)::ICEDiag CheckICE(const clang::Expr *, const clang::ASTContext &):
        Assertion `!E->isValueDependent() && "Should not see value dependent exprs!"' failed.
      In C++11 mode, that assert does not trigger.
      
      This commit works around this in the check. We don't check
      value-dependent indices and instead check their specialization.
      
      Reviewers: alexfh, aaron.ballman
      
      Subscribers: nemanjai, cfe-commits
      
      Differential Revision: http://reviews.llvm.org/D22190
      
      llvm-svn: 275461
      03fadabe
  21. 03 May, 2016 1 commit
  22. 02 May, 2016 1 commit
  23. 13 Dec, 2015 1 commit
  24. 18 Nov, 2015 1 commit
  25. 17 Nov, 2015 1 commit