[PATCH] D44597: [CFG] [analyzer] Add C++17-specific variable and return value construction contexts.
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 16 18:43:50 PDT 2018
NoQ added inline comments.
================
Comment at: test/Analysis/cfg-rich-constructors.cpp:481-486
+// CXX11: [B1]
+// CXX11-NEXT: 1: [B4.4].~D() (Implicit destructor)
+// CXX11: [B2]
+// CXX11-NEXT: 1: ~temporary_object_expr_with_dtors::D() (Temporary object destructor)
+// CXX11: [B3]
+// CXX11-NEXT: 1: ~temporary_object_expr_with_dtors::D() (Temporary object destructor)
----------------
I decided to include/document/test this part of CFG as well (even though previously it was omitted from the test) because while working on this patch i realized that it's completely correct. Previously i was ranting (@xazax.hun remembers me ranting) that i don't understand why do we need a second diamond in the CFG with two destructors on each path. But it's quite obvious: we destroy the original temporary at the end of the full-ex...-uhm-i-mean-statement, and then we need to destroy the lifetime-extended elidable copy of the respective temporary. So for the purposes of the CFG there are indeed two diamonds with correlated conditions - which will turn into two separate paths in the ExplodedGraph. It's nice to know that in C++17 we don't have that diamond at all - only the first diamond.
Repository:
rC Clang
https://reviews.llvm.org/D44597
More information about the cfe-commits
mailing list