[all-commits] [llvm/llvm-project] 32fe1a: [analyzer] Fixing SVal::getType returns Null Type ...

Ella Ma via All-commits all-commits at lists.llvm.org
Thu Jul 14 07:06:58 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 32fe1a4be95c90da9a24d63a097429ec7c3bbfba
      https://github.com/llvm/llvm-project/commit/32fe1a4be95c90da9a24d63a097429ec7c3bbfba
  Author: Ella Ma <alansnape3058 at gmail.com>
  Date:   2022-07-14 (Thu, 14 Jul 2022)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/SVals.cpp
    M clang/unittests/StaticAnalyzer/SValTest.cpp

  Log Message:
  -----------
  [analyzer] Fixing SVal::getType returns Null Type for NonLoc::ConcreteInt in boolean type

In method `TypeRetrievingVisitor::VisitConcreteInt`, `ASTContext::getIntTypeForBitwidth` is used to get the type for `ConcreteInt`s.
However, the getter in ASTContext cannot handle the boolean type with the bit width of 1, which will make method `SVal::getType` return a Null `Type`.
In this patch, a check for this case is added to fix this problem by returning the bool type directly when the bit width is 1.

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




More information about the All-commits mailing list