[all-commits] [llvm/llvm-project] 813734: [Analyzer] Add `getReturnValueUnderConstruction()`...

Balogh, Ádám via All-commits all-commits at lists.llvm.org
Tue Jun 9 03:07:32 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 813734dad7e8b526c39806d1a88820b1f0706fb1
      https://github.com/llvm/llvm-project/commit/813734dad7e8b526c39806d1a88820b1f0706fb1
  Author: Adam Balogh <adam.balogh at ericsson.com>
  Date:   2020-06-09 (Tue, 09 Jun 2020)

  Changed paths:
    M clang/include/clang/Analysis/AnalysisDeclContext.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
    M clang/lib/StaticAnalyzer/Core/CallEvent.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
    M clang/unittests/StaticAnalyzer/CMakeLists.txt
    A clang/unittests/StaticAnalyzer/TestReturnValueUnderConstruction.cpp

  Log Message:
  -----------
  [Analyzer] Add `getReturnValueUnderConstruction()` to `CallEvent`

Checkers should be able to get the return value under construction for a
`CallEvenet`. This patch adds a function to achieve this which retrieves
the return value from the construction context of the call.

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


  Commit: 98db1f990fc273adc1ae36d4ce97ce66fd27ac30
      https://github.com/llvm/llvm-project/commit/98db1f990fc273adc1ae36d4ce97ce66fd27ac30
  Author: Adam Balogh <adam.balogh at ericsson.com>
  Date:   2020-06-09 (Tue, 09 Jun 2020)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/Regions.def
    M clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
    M clang/lib/StaticAnalyzer/Core/CallEvent.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
    M clang/lib/StaticAnalyzer/Core/MemRegion.cpp
    M clang/lib/StaticAnalyzer/Core/Store.cpp
    M clang/test/Analysis/explain-svals.c
    M clang/test/Analysis/explain-svals.cpp
    M clang/test/Analysis/explain-svals.m
    M clang/unittests/StaticAnalyzer/CMakeLists.txt
    A clang/unittests/StaticAnalyzer/ParamRegionTest.cpp

  Log Message:
  -----------
  [Analyzer] [NFC] Parameter Regions

Currently, parameters of functions without their definition present cannot
be represented as regions because it would be difficult to ensure that the
same declaration is used in every case. To overcome this, we split
`VarRegion` to two subclasses: `NonParamVarRegion` and `ParamVarRegion`.
The latter does not store the `Decl` of the parameter variable. Instead it
stores the index of the parameter which enables retrieving the actual
`Decl` every time using the function declaration of the stack frame. To
achieve this we also removed storing of `Decl` from `DeclRegion` and made
`getDecl()` pure virtual. The individual `Decl`s are stored in the
appropriate subclasses, such as `FieldRegion`, `ObjCIvarRegion` and the
newly introduced `NonParamVarRegion`.

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


  Commit: 5419a3121522fe1251d52c7f1fb790d68581e549
      https://github.com/llvm/llvm-project/commit/5419a3121522fe1251d52c7f1fb790d68581e549
  Author: Adam Balogh <adam.balogh at ericsson.com>
  Date:   2020-06-09 (Tue, 09 Jun 2020)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/CallEvent.cpp
    M clang/test/Analysis/explain-svals.cpp
    M clang/test/Analysis/temporaries.cpp
    M clang/unittests/StaticAnalyzer/ParamRegionTest.cpp

  Log Message:
  -----------
  [Analyzer] Allow creation of stack frame for functions without definition

Retrieving the parameter location of functions was disabled because it
may causes crashes due to the fact that functions may have multiple
declarations and without definition it is difficult to ensure that
always the same declration is used. Now parameters are stored in
`ParamRegions` which are independent of the declaration of the function,
therefore the same parameters always have the same regions,
independently of the function declaration used actually. This allows us
to remove the limitation described above.

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


Compare: https://github.com/llvm/llvm-project/compare/17798c60bcc2...5419a3121522


More information about the All-commits mailing list