[PATCH] D47671: [analyzer] Implement copy elision.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 13 17:50:50 PDT 2018


NoQ updated this revision to Diff 151279.
NoQ added a comment.

I added an option to disable copy elision on CFG side in https://reviews.llvm.org/D47616. The analyzer makes use of it automagically: elided constructors are replaced with temporary constructors in the CFG and the old behavior is restored.

Tests now test both behaviors and demonstrate that C++17 mandatory copy elision works exactly like pre-C++17 optional copy elision, despite underlying AST being completely different. Well, most of the time: there's still a bug that causes us to think that we need to call a destructor on the elided temporary. Thankfully, such destructor would be evaluated conservatively.


https://reviews.llvm.org/D47671

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  test/Analysis/cxx17-mandatory-elision.cpp
  test/Analysis/gtest.cpp
  test/Analysis/inlining/temp-dtors-path-notes.cpp
  test/Analysis/lifetime-extension.cpp
  test/Analysis/temporaries.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47671.151279.patch
Type: text/x-patch
Size: 36800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180614/92d0a24f/attachment-0001.bin>


More information about the cfe-commits mailing list