[all-commits] [llvm/llvm-project] 16be17: [analyzer][NFC] Refactor llvm::isa<> usages in the...

Balazs Benics via All-commits all-commits at lists.llvm.org
Wed Oct 20 08:44:32 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 16be17ad4b13deb23c893c3c668076e70b07f289
      https://github.com/llvm/llvm-project/commit/16be17ad4b13deb23c893c3c668076e70b07f289
  Author: Balazs Benics <balazs.benics at sigmatechnology.se>
  Date:   2021-10-20 (Wed, 20 Oct 2021)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
    M clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
    M clang/lib/StaticAnalyzer/Core/BugReporter.cpp
    M clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
    M clang/lib/StaticAnalyzer/Core/CallEvent.cpp
    M clang/lib/StaticAnalyzer/Core/CheckerContext.cpp
    M clang/lib/StaticAnalyzer/Core/Environment.cpp
    M clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
    M clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp
    M clang/lib/StaticAnalyzer/Core/LoopWidening.cpp
    M clang/lib/StaticAnalyzer/Core/MemRegion.cpp
    M clang/lib/StaticAnalyzer/Core/RegionStore.cpp
    M clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
    M clang/lib/StaticAnalyzer/Core/Store.cpp
    M clang/lib/StaticAnalyzer/Core/SymbolManager.cpp

  Log Message:
  -----------
  [analyzer][NFC] Refactor llvm::isa<> usages in the StaticAnalyzer

It turns out llvm::isa<> is variadic, and we could have used this at a
lot of places.

The following patterns:
  x && isa<T1>(x) || isa<T2>(x) ...
Will be replaced by:
  isa_and_non_null<T1, T2, ...>(x)

Sometimes it caused further simplifications, when it would cause even
more code smell.

Aside from this, keep in mind that within `assert()` or any macro
functions, we need to wrap the isa<> expression within a parenthesis,
due to the parsing of the comma.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D111982




More information about the All-commits mailing list