[PATCH] D43481: [CFG] [analyzer] Add construction context when the constructor is being no-op-casted to a const value type.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 19 14:13:52 PST 2018


NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a.sidorin, george.karpenkov, szepet.
Herald added subscribers: cfe-commits, rnkovacs.

Because lifetime-extended temporaries are treated as const objects, an implicit `NoOp` cast to `const` usually surrounds them in the AST, somewhere between `MaterializeTemporaryExpr` and `CXXBindTemporaryExpr`. Skip the cast while looking for the construction context.

In the Analyzer this, again, is more useful for adding `MaterializeTemporaryExpr` to existing contexts (which are still to be used) than to finding more "top-level" contexts, because `CXXBindTemporaryExpr` is usually enough to provide some context, and if there's no `CXXBindTemporaryExpr` then we're having no destructors and we'd inline the constructor anyway. So there are no functional changes in the analyzer yet.


Repository:
  rC Clang

https://reviews.llvm.org/D43481

Files:
  lib/Analysis/CFG.cpp
  test/Analysis/auto-obj-dtors-cfg-output.cpp
  test/Analysis/cfg-rich-constructors.cpp
  test/Analysis/temp-obj-dtors-cfg-output.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43481.134967.patch
Type: text/x-patch
Size: 12193 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180219/2b29324c/attachment-0001.bin>


More information about the cfe-commits mailing list