[PATCH] D43533: [CFG] [analyzer] NFC: Refactor ConstructionContext into a finite set of cases.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 20 15:36:24 PST 2018


NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a.sidorin, george.karpenkov, szepet.
Herald added subscribers: cfe-commits, rnkovacs, mgorny.
NoQ added a dependency: D43497: [analyzer] Introduce correct lifetime extension behavior in simple cases..

`ConstructionContext` is moved into a separate translation unit and is separated into multiple classes.

The "old" "raw" `ConstructionContext` is renamed into `ConstructionContextLayer` - which corresponds to the idea of building the context gradually layer-by-layer, but it isn't easy to use in the clients. Once `CXXConstructExpr` is reached, layers that we've gathered so far are transformed into the actual, "new-style" "flat" `ConstructionContext`, which is put into the `CFGConstructor` element and has no layers whatsoever (until it actually needs them, eg. aggregate initialization). The new-style `ConstructionContext` is instead presented as a variety of sub-classes that enumerate different ways of constructing an object in C++. There are 5 (five) of these supported for now, which is around a half of what needs to be supported.

The layer-by-layer buildup process is still a bit weird, but it's pretty functional with all the immutable stuff and pattern-matching, and i'm not seeing any easy alternatives.


Repository:
  rC Clang

https://reviews.llvm.org/D43533

Files:
  include/clang/Analysis/CFG.h
  include/clang/Analysis/ConstructionContext.h
  lib/Analysis/CFG.cpp
  lib/Analysis/CMakeLists.txt
  lib/Analysis/ConstructionContext.cpp
  lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43533.135150.patch
Type: text/x-patch
Size: 38020 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180220/7b8f1227/attachment-0001.bin>


More information about the cfe-commits mailing list