From 13fcb27431a3adf600fb74f662ad1db0d2680e58 Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Tue, 13 Dec 2016 06:33:34 -0800 Subject: [PATCH] [C++] Fix compilation errors coming from smart pointer models Summary: Our C++ model magic didn't work when instantiating smart pointers with volatile types. Fix it Reviewed By: jvillard Differential Revision: D4313271 fbshipit-source-id: 55ffb98 --- .../cpp/include/infer_model/shared_ptr.h | 15 ++++++ .../cpp/include/infer_model/unique_ptr.h | 15 ++++++ .../clang_translation/src/main.cpp.dot | 35 +++++++----- .../src/main_default_root.cpp.dot | 35 +++++++----- .../src/main_default_symlink.cpp.dot | 35 +++++++----- .../src/main_symlink.cpp.dot | 35 +++++++----- .../tests/codetoanalyze/cpp/errors/issues.exp | 8 +++ .../errors/smart_ptr/const_volatile_type.cpp | 54 +++++++++++++++++++ 8 files changed, 184 insertions(+), 48 deletions(-) create mode 100644 infer/tests/codetoanalyze/cpp/errors/smart_ptr/const_volatile_type.cpp diff --git a/infer/models/cpp/include/infer_model/shared_ptr.h b/infer/models/cpp/include/infer_model/shared_ptr.h index 56c0e5906..f51ecbc66 100644 --- a/infer/models/cpp/include/infer_model/shared_ptr.h +++ b/infer/models/cpp/include/infer_model/shared_ptr.h @@ -47,10 +47,25 @@ class shared_ptr : public std__shared_ptr { // use it to avoid compilation errors and make infer analyzer happy #define __cast_to_infer_ptr(self) ((infer_shared_ptr_t)self) + // provide overload for volatile void* to accomodate for situation when + // T is volatile ('volatile int' for example). 'void*' and 'nullptr_t' + // overloads are to avoid 'call to model_set is ambiguous' compilation errors + static void model_set(infer_shared_ptr_t self, nullptr_t value) { + *self = value; + } + static void model_set(infer_shared_ptr_t self, const void* value) { *self = value; } + static void model_set(infer_shared_ptr_t self, volatile void* value) { + *self = const_cast(value); + } + + static void model_set(infer_shared_ptr_t self, void* value) { + *self = const_cast(value); + } + static void model_copy(infer_shared_ptr_t self, infer_shared_ptr_t other) { /* TODO - increase refcount*/ *self = *other; diff --git a/infer/models/cpp/include/infer_model/unique_ptr.h b/infer/models/cpp/include/infer_model/unique_ptr.h index 1b9c1b4f4..e1f1eab09 100644 --- a/infer/models/cpp/include/infer_model/unique_ptr.h +++ b/infer/models/cpp/include/infer_model/unique_ptr.h @@ -50,10 +50,25 @@ struct unique_ptr { // use it to avoid compilation errors and make infer analyzer happy #define __cast_to_infer_ptr(self) ((infer_unique_ptr_t)self) + // provide overload for volatile void* to accomodate for situation when + // T is volatile ('volatile int' for example). 'void*' and 'nullptr_t' + // overloads are to avoid 'call to model_set is ambiguous' compilation errors + static void model_set(infer_unique_ptr_t self, nullptr_t value) { + *self = value; + } + static void model_set(infer_unique_ptr_t self, const void* value) { *self = value; } + static void model_set(infer_unique_ptr_t self, volatile void* value) { + *self = const_cast(value); + } + + static void model_set(infer_unique_ptr_t self, void* value) { + *self = const_cast(value); + } + static void model_move(infer_unique_ptr_t self, infer_unique_ptr_t other) { *self = *other; model_set(other, nullptr); diff --git a/infer/tests/build_systems/codetoanalyze/clang_translation/src/main.cpp.dot b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main.cpp.dot index f41717c24..61804b695 100644 --- a/infer/tests/build_systems/codetoanalyze/clang_translation/src/main.cpp.dot +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main.cpp.dot @@ -64,51 +64,62 @@ digraph iCFG { "unused_deref_in_header{d41d8cd98f00b204e9800998ecf8427e_Z22unused_deref_in_headerPi}.78f023ac84a54d52e15a570dccffee2c_4" -> "unused_deref_in_header{d41d8cd98f00b204e9800998ecf8427e_Z22unused_deref_in_headerPi}.78f023ac84a54d52e15a570dccffee2c_3" ; -"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_1" [label="1: Start std::__1::shared_ptr_model_set\nFormals: self:void** value:void*\nLocals: \n DECLARE_LOCALS(&return); [line 50]\n " color=yellow style=filled] +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_1" [label="1: Start std::__1::shared_ptr_model_set\nFormals: self:void** value:int\nLocals: \n DECLARE_LOCALS(&return); [line 53]\n " color=yellow style=filled] - "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" ; -"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_2" [label="2: Exit std::__1::shared_ptr_model_set \n " color=yellow style=filled] + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_3" ; +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_2" [label="2: Exit std::__1::shared_ptr_model_set \n " color=yellow style=filled] -"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" [label="3: BinaryOperatorStmt: Assign \n n$0=*&self:void** [line 51]\n n$1=*&value:void* [line 51]\n *n$0:void*=n$1 [line 51]\n " shape="box"] +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_3" [label="3: BinaryOperatorStmt: Assign \n n$0=*&self:void** [line 54]\n n$1=*&value:int [line 54]\n *n$0:void*=n$1 [line 54]\n " shape="box"] - "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_2" ; -"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_1" [label="1: Start std::__1::shared_ptr_shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 84]\n " color=yellow style=filled] + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_2" ; +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_1" [label="1: Start std::__1::shared_ptr_model_set\nFormals: self:void** value:void*\nLocals: \n DECLARE_LOCALS(&return); [line 65]\n " color=yellow style=filled] + + + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_3" ; +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_2" [label="2: Exit std::__1::shared_ptr_model_set \n " color=yellow style=filled] + + +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_3" [label="3: BinaryOperatorStmt: Assign \n n$0=*&self:void** [line 66]\n n$1=*&value:void* [line 66]\n *n$0:void*=n$1 [line 66]\n " shape="box"] + + + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_2" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_1" [label="1: Start std::__1::shared_ptr_shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 99]\n " color=yellow style=filled] "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_1" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" ; "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_2" [label="2: Exit std::__1::shared_ptr_shared_ptr \n " color=yellow style=filled] -"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 85]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,null:void*) [line 85]\n " shape="box"] +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 100]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,null:int) [line 100]\n " shape="box"] "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_2" ; -"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" [label="4: Constructor Init \n n$1=*&this:int** [line 85]\n _fun_std::__1::std__shared_ptr_std__shared_ptr(n$1:int**) [line 84]\n n$2=*n$1:int* [line 84]\n " shape="box"] +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" [label="4: Constructor Init \n n$1=*&this:int** [line 100]\n _fun_std::__1::std__shared_ptr_std__shared_ptr(n$1:int**) [line 99]\n n$2=*n$1:int* [line 99]\n " shape="box"] "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" ; -"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_1" [label="1: Start std::__1::shared_ptr_~shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 165]\n " color=yellow style=filled] +"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_1" [label="1: Start std::__1::shared_ptr_~shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 180]\n " color=yellow style=filled] "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_1" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" ; "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_2" [label="2: Exit std::__1::shared_ptr_~shared_ptr \n " color=yellow style=filled] -"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" [label="3: Call _fun_std::__1::shared_ptr_reset \n n$0=*&this:int** [line 165]\n _=*n$0:int* [line 165]\n _fun_std::__1::shared_ptr_reset(n$0:int**,null:int*) [line 165]\n " shape="box"] +"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" [label="3: Call _fun_std::__1::shared_ptr_reset \n n$0=*&this:int** [line 180]\n _=*n$0:int* [line 180]\n _fun_std::__1::shared_ptr_reset(n$0:int**,null:int*) [line 180]\n " shape="box"] "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_2" ; -"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_1" [label="1: Start std::__1::shared_ptr_reset\nFormals: this:int** p:int*\nLocals: \n DECLARE_LOCALS(&return); [line 217]\n " color=yellow style=filled] +"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_1" [label="1: Start std::__1::shared_ptr_reset\nFormals: this:int** p:int*\nLocals: \n DECLARE_LOCALS(&return); [line 232]\n " color=yellow style=filled] "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_1" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" ; "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_2" [label="2: Exit std::__1::shared_ptr_reset \n " color=yellow style=filled] -"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 223]\n n$1=*&p:int* [line 223]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,n$1:void*) [line 223]\n " shape="box"] +"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 238]\n n$1=*&p:int* [line 238]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,n$1:void*) [line 238]\n " shape="box"] "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_2" ; diff --git a/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_root.cpp.dot b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_root.cpp.dot index f41717c24..61804b695 100644 --- a/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_root.cpp.dot +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_root.cpp.dot @@ -64,51 +64,62 @@ digraph iCFG { "unused_deref_in_header{d41d8cd98f00b204e9800998ecf8427e_Z22unused_deref_in_headerPi}.78f023ac84a54d52e15a570dccffee2c_4" -> "unused_deref_in_header{d41d8cd98f00b204e9800998ecf8427e_Z22unused_deref_in_headerPi}.78f023ac84a54d52e15a570dccffee2c_3" ; -"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_1" [label="1: Start std::__1::shared_ptr_model_set\nFormals: self:void** value:void*\nLocals: \n DECLARE_LOCALS(&return); [line 50]\n " color=yellow style=filled] +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_1" [label="1: Start std::__1::shared_ptr_model_set\nFormals: self:void** value:int\nLocals: \n DECLARE_LOCALS(&return); [line 53]\n " color=yellow style=filled] - "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" ; -"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_2" [label="2: Exit std::__1::shared_ptr_model_set \n " color=yellow style=filled] + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_3" ; +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_2" [label="2: Exit std::__1::shared_ptr_model_set \n " color=yellow style=filled] -"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" [label="3: BinaryOperatorStmt: Assign \n n$0=*&self:void** [line 51]\n n$1=*&value:void* [line 51]\n *n$0:void*=n$1 [line 51]\n " shape="box"] +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_3" [label="3: BinaryOperatorStmt: Assign \n n$0=*&self:void** [line 54]\n n$1=*&value:int [line 54]\n *n$0:void*=n$1 [line 54]\n " shape="box"] - "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_2" ; -"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_1" [label="1: Start std::__1::shared_ptr_shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 84]\n " color=yellow style=filled] + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_2" ; +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_1" [label="1: Start std::__1::shared_ptr_model_set\nFormals: self:void** value:void*\nLocals: \n DECLARE_LOCALS(&return); [line 65]\n " color=yellow style=filled] + + + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_3" ; +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_2" [label="2: Exit std::__1::shared_ptr_model_set \n " color=yellow style=filled] + + +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_3" [label="3: BinaryOperatorStmt: Assign \n n$0=*&self:void** [line 66]\n n$1=*&value:void* [line 66]\n *n$0:void*=n$1 [line 66]\n " shape="box"] + + + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_2" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_1" [label="1: Start std::__1::shared_ptr_shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 99]\n " color=yellow style=filled] "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_1" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" ; "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_2" [label="2: Exit std::__1::shared_ptr_shared_ptr \n " color=yellow style=filled] -"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 85]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,null:void*) [line 85]\n " shape="box"] +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 100]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,null:int) [line 100]\n " shape="box"] "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_2" ; -"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" [label="4: Constructor Init \n n$1=*&this:int** [line 85]\n _fun_std::__1::std__shared_ptr_std__shared_ptr(n$1:int**) [line 84]\n n$2=*n$1:int* [line 84]\n " shape="box"] +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" [label="4: Constructor Init \n n$1=*&this:int** [line 100]\n _fun_std::__1::std__shared_ptr_std__shared_ptr(n$1:int**) [line 99]\n n$2=*n$1:int* [line 99]\n " shape="box"] "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" ; -"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_1" [label="1: Start std::__1::shared_ptr_~shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 165]\n " color=yellow style=filled] +"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_1" [label="1: Start std::__1::shared_ptr_~shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 180]\n " color=yellow style=filled] "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_1" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" ; "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_2" [label="2: Exit std::__1::shared_ptr_~shared_ptr \n " color=yellow style=filled] -"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" [label="3: Call _fun_std::__1::shared_ptr_reset \n n$0=*&this:int** [line 165]\n _=*n$0:int* [line 165]\n _fun_std::__1::shared_ptr_reset(n$0:int**,null:int*) [line 165]\n " shape="box"] +"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" [label="3: Call _fun_std::__1::shared_ptr_reset \n n$0=*&this:int** [line 180]\n _=*n$0:int* [line 180]\n _fun_std::__1::shared_ptr_reset(n$0:int**,null:int*) [line 180]\n " shape="box"] "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_2" ; -"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_1" [label="1: Start std::__1::shared_ptr_reset\nFormals: this:int** p:int*\nLocals: \n DECLARE_LOCALS(&return); [line 217]\n " color=yellow style=filled] +"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_1" [label="1: Start std::__1::shared_ptr_reset\nFormals: this:int** p:int*\nLocals: \n DECLARE_LOCALS(&return); [line 232]\n " color=yellow style=filled] "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_1" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" ; "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_2" [label="2: Exit std::__1::shared_ptr_reset \n " color=yellow style=filled] -"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 223]\n n$1=*&p:int* [line 223]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,n$1:void*) [line 223]\n " shape="box"] +"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 238]\n n$1=*&p:int* [line 238]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,n$1:void*) [line 238]\n " shape="box"] "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_2" ; diff --git a/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_symlink.cpp.dot b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_symlink.cpp.dot index f41717c24..61804b695 100644 --- a/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_symlink.cpp.dot +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_symlink.cpp.dot @@ -64,51 +64,62 @@ digraph iCFG { "unused_deref_in_header{d41d8cd98f00b204e9800998ecf8427e_Z22unused_deref_in_headerPi}.78f023ac84a54d52e15a570dccffee2c_4" -> "unused_deref_in_header{d41d8cd98f00b204e9800998ecf8427e_Z22unused_deref_in_headerPi}.78f023ac84a54d52e15a570dccffee2c_3" ; -"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_1" [label="1: Start std::__1::shared_ptr_model_set\nFormals: self:void** value:void*\nLocals: \n DECLARE_LOCALS(&return); [line 50]\n " color=yellow style=filled] +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_1" [label="1: Start std::__1::shared_ptr_model_set\nFormals: self:void** value:int\nLocals: \n DECLARE_LOCALS(&return); [line 53]\n " color=yellow style=filled] - "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" ; -"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_2" [label="2: Exit std::__1::shared_ptr_model_set \n " color=yellow style=filled] + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_3" ; +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_2" [label="2: Exit std::__1::shared_ptr_model_set \n " color=yellow style=filled] -"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" [label="3: BinaryOperatorStmt: Assign \n n$0=*&self:void** [line 51]\n n$1=*&value:void* [line 51]\n *n$0:void*=n$1 [line 51]\n " shape="box"] +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_3" [label="3: BinaryOperatorStmt: Assign \n n$0=*&self:void** [line 54]\n n$1=*&value:int [line 54]\n *n$0:void*=n$1 [line 54]\n " shape="box"] - "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_2" ; -"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_1" [label="1: Start std::__1::shared_ptr_shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 84]\n " color=yellow style=filled] + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_2" ; +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_1" [label="1: Start std::__1::shared_ptr_model_set\nFormals: self:void** value:void*\nLocals: \n DECLARE_LOCALS(&return); [line 65]\n " color=yellow style=filled] + + + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_3" ; +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_2" [label="2: Exit std::__1::shared_ptr_model_set \n " color=yellow style=filled] + + +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_3" [label="3: BinaryOperatorStmt: Assign \n n$0=*&self:void** [line 66]\n n$1=*&value:void* [line 66]\n *n$0:void*=n$1 [line 66]\n " shape="box"] + + + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_2" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_1" [label="1: Start std::__1::shared_ptr_shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 99]\n " color=yellow style=filled] "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_1" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" ; "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_2" [label="2: Exit std::__1::shared_ptr_shared_ptr \n " color=yellow style=filled] -"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 85]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,null:void*) [line 85]\n " shape="box"] +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 100]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,null:int) [line 100]\n " shape="box"] "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_2" ; -"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" [label="4: Constructor Init \n n$1=*&this:int** [line 85]\n _fun_std::__1::std__shared_ptr_std__shared_ptr(n$1:int**) [line 84]\n n$2=*n$1:int* [line 84]\n " shape="box"] +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" [label="4: Constructor Init \n n$1=*&this:int** [line 100]\n _fun_std::__1::std__shared_ptr_std__shared_ptr(n$1:int**) [line 99]\n n$2=*n$1:int* [line 99]\n " shape="box"] "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" ; -"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_1" [label="1: Start std::__1::shared_ptr_~shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 165]\n " color=yellow style=filled] +"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_1" [label="1: Start std::__1::shared_ptr_~shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 180]\n " color=yellow style=filled] "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_1" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" ; "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_2" [label="2: Exit std::__1::shared_ptr_~shared_ptr \n " color=yellow style=filled] -"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" [label="3: Call _fun_std::__1::shared_ptr_reset \n n$0=*&this:int** [line 165]\n _=*n$0:int* [line 165]\n _fun_std::__1::shared_ptr_reset(n$0:int**,null:int*) [line 165]\n " shape="box"] +"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" [label="3: Call _fun_std::__1::shared_ptr_reset \n n$0=*&this:int** [line 180]\n _=*n$0:int* [line 180]\n _fun_std::__1::shared_ptr_reset(n$0:int**,null:int*) [line 180]\n " shape="box"] "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_2" ; -"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_1" [label="1: Start std::__1::shared_ptr_reset\nFormals: this:int** p:int*\nLocals: \n DECLARE_LOCALS(&return); [line 217]\n " color=yellow style=filled] +"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_1" [label="1: Start std::__1::shared_ptr_reset\nFormals: this:int** p:int*\nLocals: \n DECLARE_LOCALS(&return); [line 232]\n " color=yellow style=filled] "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_1" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" ; "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_2" [label="2: Exit std::__1::shared_ptr_reset \n " color=yellow style=filled] -"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 223]\n n$1=*&p:int* [line 223]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,n$1:void*) [line 223]\n " shape="box"] +"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 238]\n n$1=*&p:int* [line 238]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,n$1:void*) [line 238]\n " shape="box"] "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_2" ; diff --git a/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_symlink.cpp.dot b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_symlink.cpp.dot index f41717c24..61804b695 100644 --- a/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_symlink.cpp.dot +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_symlink.cpp.dot @@ -64,51 +64,62 @@ digraph iCFG { "unused_deref_in_header{d41d8cd98f00b204e9800998ecf8427e_Z22unused_deref_in_headerPi}.78f023ac84a54d52e15a570dccffee2c_4" -> "unused_deref_in_header{d41d8cd98f00b204e9800998ecf8427e_Z22unused_deref_in_headerPi}.78f023ac84a54d52e15a570dccffee2c_3" ; -"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_1" [label="1: Start std::__1::shared_ptr_model_set\nFormals: self:void** value:void*\nLocals: \n DECLARE_LOCALS(&return); [line 50]\n " color=yellow style=filled] +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_1" [label="1: Start std::__1::shared_ptr_model_set\nFormals: self:void** value:int\nLocals: \n DECLARE_LOCALS(&return); [line 53]\n " color=yellow style=filled] - "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" ; -"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_2" [label="2: Exit std::__1::shared_ptr_model_set \n " color=yellow style=filled] + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_3" ; +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_2" [label="2: Exit std::__1::shared_ptr_model_set \n " color=yellow style=filled] -"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" [label="3: BinaryOperatorStmt: Assign \n n$0=*&self:void** [line 51]\n n$1=*&value:void* [line 51]\n *n$0:void*=n$1 [line 51]\n " shape="box"] +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_3" [label="3: BinaryOperatorStmt: Assign \n n$0=*&self:void** [line 54]\n n$1=*&value:int [line 54]\n *n$0:void*=n$1 [line 54]\n " shape="box"] - "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_2" ; -"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_1" [label="1: Start std::__1::shared_ptr_shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 84]\n " color=yellow style=filled] + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvDn).603a5b50e9cb50a015cb89275a6b4a02_2" ; +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_1" [label="1: Start std::__1::shared_ptr_model_set\nFormals: self:void** value:void*\nLocals: \n DECLARE_LOCALS(&return); [line 65]\n " color=yellow style=filled] + + + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_3" ; +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_2" [label="2: Exit std::__1::shared_ptr_model_set \n " color=yellow style=filled] + + +"std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_3" [label="3: BinaryOperatorStmt: Assign \n n$0=*&self:void** [line 66]\n n$1=*&value:void* [line 66]\n *n$0:void*=n$1 [line 66]\n " shape="box"] + + + "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvPv).f20560d1c1b5289ad1a513e8f9e363c5_2" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_1" [label="1: Start std::__1::shared_ptr_shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 99]\n " color=yellow style=filled] "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_1" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" ; "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_2" [label="2: Exit std::__1::shared_ptr_shared_ptr \n " color=yellow style=filled] -"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 85]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,null:void*) [line 85]\n " shape="box"] +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 100]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,null:int) [line 100]\n " shape="box"] "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_2" ; -"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" [label="4: Constructor Init \n n$1=*&this:int** [line 85]\n _fun_std::__1::std__shared_ptr_std__shared_ptr(n$1:int**) [line 84]\n n$2=*n$1:int* [line 84]\n " shape="box"] +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" [label="4: Constructor Init \n n$1=*&this:int** [line 100]\n _fun_std::__1::std__shared_ptr_std__shared_ptr(n$1:int**) [line 99]\n n$2=*n$1:int* [line 99]\n " shape="box"] "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_4" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev|constexpr}.be99763d4002918a1c3f3b37430d6542_3" ; -"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_1" [label="1: Start std::__1::shared_ptr_~shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 165]\n " color=yellow style=filled] +"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_1" [label="1: Start std::__1::shared_ptr_~shared_ptr\nFormals: this:int**\nLocals: \n DECLARE_LOCALS(&return); [line 180]\n " color=yellow style=filled] "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_1" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" ; "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_2" [label="2: Exit std::__1::shared_ptr_~shared_ptr \n " color=yellow style=filled] -"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" [label="3: Call _fun_std::__1::shared_ptr_reset \n n$0=*&this:int** [line 165]\n _=*n$0:int* [line 165]\n _fun_std::__1::shared_ptr_reset(n$0:int**,null:int*) [line 165]\n " shape="box"] +"std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" [label="3: Call _fun_std::__1::shared_ptr_reset \n n$0=*&this:int** [line 180]\n _=*n$0:int* [line 180]\n _fun_std::__1::shared_ptr_reset(n$0:int**,null:int*) [line 180]\n " shape="box"] "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_2" ; -"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_1" [label="1: Start std::__1::shared_ptr_reset\nFormals: this:int** p:int*\nLocals: \n DECLARE_LOCALS(&return); [line 217]\n " color=yellow style=filled] +"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_1" [label="1: Start std::__1::shared_ptr_reset\nFormals: this:int** p:int*\nLocals: \n DECLARE_LOCALS(&return); [line 232]\n " color=yellow style=filled] "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_1" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" ; "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_2" [label="2: Exit std::__1::shared_ptr_reset \n " color=yellow style=filled] -"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 223]\n n$1=*&p:int* [line 223]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,n$1:void*) [line 223]\n " shape="box"] +"std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" [label="3: Call _fun_std::__1::shared_ptr_model_set \n n$0=*&this:int** [line 238]\n n$1=*&p:int* [line 238]\n _fun_std::__1::shared_ptr_model_set(n$0:void**,n$1:void*) [line 238]\n " shape="box"] "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_2" ; diff --git a/infer/tests/codetoanalyze/cpp/errors/issues.exp b/infer/tests/codetoanalyze/cpp/errors/issues.exp index a238582fe..432383706 100644 --- a/infer/tests/codetoanalyze/cpp/errors/issues.exp +++ b/infer/tests/codetoanalyze/cpp/errors/issues.exp @@ -40,6 +40,14 @@ codetoanalyze/cpp/errors/numeric/min_max.cpp, min_X_div0, 2, DIVIDE_BY_ZERO, [st codetoanalyze/cpp/errors/numeric/min_max.cpp, min_int_div0, 0, DIVIDE_BY_ZERO, [start of procedure min_int_div0()] codetoanalyze/cpp/errors/overwrite_attribute/main.cpp, testSetIntValue, 3, DIVIDE_BY_ZERO, [start of procedure testSetIntValue(),start of procedure setIntValue(),return from a call to setIntValue] codetoanalyze/cpp/errors/resource_leaks/raii.cpp, resource_leak, 7, RESOURCE_LEAK, [start of procedure resource_leak(),Condition is false] +codetoanalyze/cpp/errors/smart_ptr/const_volatile_type.cpp, test_const1, 3, NULL_DEREFERENCE, [start of procedure test_const1()] +codetoanalyze/cpp/errors/smart_ptr/const_volatile_type.cpp, test_const2, 2, NULL_DEREFERENCE, [start of procedure test_const2()] +codetoanalyze/cpp/errors/smart_ptr/const_volatile_type.cpp, test_const3, 3, NULL_DEREFERENCE, [start of procedure test_const3()] +codetoanalyze/cpp/errors/smart_ptr/const_volatile_type.cpp, test_const4, 2, NULL_DEREFERENCE, [start of procedure test_const4()] +codetoanalyze/cpp/errors/smart_ptr/const_volatile_type.cpp, test_volatile1, 3, NULL_DEREFERENCE, [start of procedure test_volatile1()] +codetoanalyze/cpp/errors/smart_ptr/const_volatile_type.cpp, test_volatile2, 2, NULL_DEREFERENCE, [start of procedure test_volatile2()] +codetoanalyze/cpp/errors/smart_ptr/const_volatile_type.cpp, test_volatile3, 3, NULL_DEREFERENCE, [start of procedure test_volatile3()] +codetoanalyze/cpp/errors/smart_ptr/const_volatile_type.cpp, test_volatile4, 2, NULL_DEREFERENCE, [start of procedure test_volatile4()] codetoanalyze/cpp/errors/smart_ptr/deref_after_move_example.cpp, deref_after_mode_example::deref_after_move_crash, 4, NULL_DEREFERENCE, [start of procedure deref_after_mode_example::deref_after_move_crash(),start of procedure Person,return from a call to deref_after_mode_example::Person_Person,start of procedure move_age,return from a call to deref_after_mode_example::Person_move_age,start of procedure access_age] codetoanalyze/cpp/errors/smart_ptr/deref_after_move_example.cpp, deref_after_mode_example::deref_after_move_ok, 4, MEMORY_LEAK, [start of procedure deref_after_mode_example::deref_after_move_ok(),start of procedure Person,return from a call to deref_after_mode_example::Person_Person,start of procedure move_age,return from a call to deref_after_mode_example::Person_move_age,return from a call to deref_after_mode_example::deref_after_move_ok] codetoanalyze/cpp/errors/smart_ptr/deref_after_move_example.cpp, deref_after_mode_example::deref_ok, 3, MEMORY_LEAK, [start of procedure deref_after_mode_example::deref_ok(),start of procedure Person,return from a call to deref_after_mode_example::Person_Person,start of procedure access_age,return from a call to deref_after_mode_example::Person_access_age,return from a call to deref_after_mode_example::deref_ok] diff --git a/infer/tests/codetoanalyze/cpp/errors/smart_ptr/const_volatile_type.cpp b/infer/tests/codetoanalyze/cpp/errors/smart_ptr/const_volatile_type.cpp new file mode 100644 index 000000000..fa6928619 --- /dev/null +++ b/infer/tests/codetoanalyze/cpp/errors/smart_ptr/const_volatile_type.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#include + +int test_volatile1() { + std::unique_ptr x; + std::unique_ptr y = std::move(x); + return *y; +} + +int test_volatile2() { + std::unique_ptr x; + return *x; +} + +int test_volatile3() { + std::shared_ptr x; + std::shared_ptr y = std::move(x); + return *y; +} + +int test_volatile4() { + std::shared_ptr x; + return *x; +} + +int test_const1() { + std::unique_ptr x; + std::unique_ptr y = std::move(x); + return *y; +} + +int test_const2() { + std::unique_ptr x; + return *x; +} + +int test_const3() { + std::shared_ptr x; + std::shared_ptr y = std::move(x); + return *y; +} + +int test_const4() { + std::shared_ptr x; + return *x; +}