From 4512fcd8efd44191d7fe5276012d966316d3bb3f Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Thu, 17 Nov 2016 03:02:12 -0800 Subject: [PATCH] [tests] Create integration tests for clang translation logic Summary: clang has very complicated logic what to translate based on `project_root` and filename. Add tests for different situations in regard of symbolic links in path/project_root Reviewed By: jvillard Differential Revision: D4168551 fbshipit-source-id: 586b364 --- Makefile | 2 +- infer/models/cpp/include/infer_model/common.h | 20 +---- .../include/infer_no_model/crash_on_exec.h | 32 +++++++ infer/src/backend/dotty.ml | 2 +- infer/src/base/Config.ml | 5 +- infer/src/base/Config.mli | 1 + infer/src/clang/ClangCommand.re | 2 +- .../build_systems/clang_translation/Makefile | 43 +++++++++ .../external_dir/external_lib.h | 13 +++ .../clang_translation/src/exclude_dir/lib.h | 13 +++ .../clang_translation/src/external | 1 + .../clang_translation/src/main.cpp | 24 +++++ .../clang_translation/src/main.cpp.dot | 89 +++++++++++++++++++ .../src/main_default_root.cpp | 1 + .../src/main_default_root.cpp.dot | 89 +++++++++++++++++++ .../src/main_default_symlink.cpp | 1 + .../src/main_default_symlink.cpp.dot | 89 +++++++++++++++++++ .../clang_translation/src/main_symlink.cpp | 1 + .../src/main_symlink.cpp.dot | 89 +++++++++++++++++++ .../clang_translation/src/project_lib.h | 16 ++++ .../clang_translation/tsrc_symlink | 1 + 21 files changed, 511 insertions(+), 23 deletions(-) create mode 100644 infer/models/cpp/include/infer_no_model/crash_on_exec.h create mode 100644 infer/tests/build_systems/clang_translation/Makefile create mode 100644 infer/tests/build_systems/codetoanalyze/clang_translation/external_dir/external_lib.h create mode 100644 infer/tests/build_systems/codetoanalyze/clang_translation/src/exclude_dir/lib.h create mode 120000 infer/tests/build_systems/codetoanalyze/clang_translation/src/external create mode 100644 infer/tests/build_systems/codetoanalyze/clang_translation/src/main.cpp create mode 100644 infer/tests/build_systems/codetoanalyze/clang_translation/src/main.cpp.dot create mode 120000 infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_root.cpp create mode 100644 infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_root.cpp.dot create mode 120000 infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_symlink.cpp create mode 100644 infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_symlink.cpp.dot create mode 120000 infer/tests/build_systems/codetoanalyze/clang_translation/src/main_symlink.cpp create mode 100644 infer/tests/build_systems/codetoanalyze/clang_translation/src/main_symlink.cpp.dot create mode 100644 infer/tests/build_systems/codetoanalyze/clang_translation/src/project_lib.h create mode 120000 infer/tests/build_systems/codetoanalyze/clang_translation/tsrc_symlink diff --git a/Makefile b/Makefile index 87f93bb35..f522c8314 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ ifeq ($(IS_FACEBOOK_TREE),yes) include $(ROOT_DIR)/facebook/Makefile.env endif -BUILD_SYSTEMS_TESTS = assembly project_root_rel +BUILD_SYSTEMS_TESTS = assembly clang_translation project_root_rel ifneq ($(ANT),no) BUILD_SYSTEMS_TESTS += ant endif diff --git a/infer/models/cpp/include/infer_model/common.h b/infer/models/cpp/include/infer_model/common.h index 4e6913b46..6b930f1de 100644 --- a/infer/models/cpp/include/infer_model/common.h +++ b/infer/models/cpp/include/infer_model/common.h @@ -10,22 +10,4 @@ #pragma once #include -#include -#include - -namespace infer_model { -// code compiled with infer headers is not supposed to be executed -struct AbortWhenRun { - AbortWhenRun() { __infer_skip__(); } - // will be skipped by analyzer - void __infer_skip__() { - fprintf(stderr, - "!!! This program must not be run !!!\n" - "This code was compiled to be analyzed by Infer.\n" - "To run this program, recompile it without Infer.\n"); - std::abort(); - } -}; - -static AbortWhenRun a{}; -} +#include diff --git a/infer/models/cpp/include/infer_no_model/crash_on_exec.h b/infer/models/cpp/include/infer_no_model/crash_on_exec.h new file mode 100644 index 000000000..d26aaaf5a --- /dev/null +++ b/infer/models/cpp/include/infer_no_model/crash_on_exec.h @@ -0,0 +1,32 @@ +/* + * 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. + */ + +#pragma once + +#include +#include + +// NOTE this header shouldn't be translated by infer - it's here to disallow +// running binaries built with infer headers +namespace infer_model { +// code compiled with infer headers is not supposed to be executed +struct AbortWhenRun { + AbortWhenRun() { __infer_skip__(); } + // will be skipped by analyzer + void __infer_skip__() { + fprintf(stderr, + "!!! This program must not be run !!!\n" + "This code was compiled to be analyzed by Infer.\n" + "To run this program, recompile it without Infer.\n"); + std::abort(); + } +}; + +static AbortWhenRun a{}; +} diff --git a/infer/src/backend/dotty.ml b/infer/src/backend/dotty.ml index dbeeb8106..cda9c3f7a 100644 --- a/infer/src/backend/dotty.ml +++ b/infer/src/backend/dotty.ml @@ -1034,7 +1034,7 @@ let print_icfg_dotty source cfg = let fname = if Config.frontend_tests then - (DB.source_file_to_string source) ^ ".test.dot" + (DB.source_file_to_abs_path source) ^ ".test.dot" else DB.filename_to_string (DB.Results_dir.path_to_filename diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 63c4c49b1..1f33060bb 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -259,10 +259,13 @@ let models_dir = let models_jar = lib_dir // "java" // "models.jar" -let cpp_models_dir = +let cpp_extra_include_dir = let dir = bin_dir // Filename.parent_dir_name // "models" // "cpp" // "include" in Utils.filename_to_absolute dir (* Normalize the path *) +let cpp_models_dir = + cpp_extra_include_dir // "infer_model" + let wrappers_dir = lib_dir // "wrappers" diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index 23adae0b9..497baf20a 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -61,6 +61,7 @@ val buck_infer_deps_file_name : string val captured_dir_name : string val checks_disabled_by_default : string list val clang_initializer_prefix : string +val cpp_extra_include_dir : string val cpp_models_dir : string val csl_analysis : bool val current_exe : CommandLineOption.exe diff --git a/infer/src/clang/ClangCommand.re b/infer/src/clang/ClangCommand.re index 503567396..20a8764c6 100644 --- a/infer/src/clang/ClangCommand.re +++ b/infer/src/clang/ClangCommand.re @@ -156,7 +156,7 @@ let with_plugin_args args => { /* -cc1 has to be the first argument or clang will think it runs in driver mode */ argv_cons "-cc1" |> /* It's important to place this option before other -isystem options. */ - argv_do_if infer_cxx_models (IList.rev_append ["-isystem", Config.cpp_models_dir]) |> + argv_do_if infer_cxx_models (IList.rev_append ["-isystem", Config.cpp_extra_include_dir]) |> IList.rev_append [ "-load", plugin_path, diff --git a/infer/tests/build_systems/clang_translation/Makefile b/infer/tests/build_systems/clang_translation/Makefile new file mode 100644 index 000000000..3972b4aa4 --- /dev/null +++ b/infer/tests/build_systems/clang_translation/Makefile @@ -0,0 +1,43 @@ +# 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. + +TESTS_DIR = ../.. + +# see explanations in cpp/errors/Makefile for the custom isystem +CLANG_OPTIONS = -x c++ -std=c++11 -nostdinc++ -isystem$(CLANG_INCLUDES)/c++/v1/ -c + +ROOT = ../codetoanalyze/clang_translation/src +SYM_ROOT = ../codetoanalyze/clang_translation/tsrc_symlink + +SOURCES = \ + $(ROOT)/main.cpp \ + $(ROOT)/main_default_root.cpp \ + $(SYM_ROOT)/main_symlink.cpp \ + $(SYM_ROOT)/main_default_symlink.cpp \ + +include $(TESTS_DIR)/clang-frontend.make + +INFER_OPTIONS = -a capture --frontend-tests --cxx --skip-translation-headers exclude_dir + +compile: + clang $(CLANG_OPTIONS) $(SOURCES) + +capture: + $(INFER_BIN) $(INFER_OPTIONS) --project-root $(ROOT) -- clang $(CLANG_OPTIONS) $(ROOT)/main.cpp + $(INFER_BIN) $(INFER_OPTIONS) --project-root $(SYM_ROOT) -- clang $(CLANG_OPTIONS) $(SYM_ROOT)/main_symlink.cpp + cd $(ROOT) && $(INFER_BIN) $(INFER_OPTIONS) -- clang $(CLANG_OPTIONS) main_default_root.cpp + cd $(SYM_ROOT) && $(INFER_BIN) $(INFER_OPTIONS) -- clang $(CLANG_OPTIONS) main_default_symlink.cpp + +# test_extra needs to be separate target. Otherwise commands from test +# target in common Makefile won't run +test: test_extra + +# all dot files should be exactly the same - if they aren't there is something wrong +test_extra: + diff $(ROOT)/main.cpp.dot $(SYM_ROOT)/main_symlink.cpp.dot && \ + diff $(ROOT)/main.cpp.dot $(ROOT)/main_default_root.cpp.dot && \ + diff $(ROOT)/main.cpp.dot $(SYM_ROOT)/main_default_symlink.cpp.dot diff --git a/infer/tests/build_systems/codetoanalyze/clang_translation/external_dir/external_lib.h b/infer/tests/build_systems/codetoanalyze/clang_translation/external_dir/external_lib.h new file mode 100644 index 000000000..9817259d5 --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/external_dir/external_lib.h @@ -0,0 +1,13 @@ +/* + * 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. + */ + +#pragma once +namespace external { +int fun(int a) { return a; } +} diff --git a/infer/tests/build_systems/codetoanalyze/clang_translation/src/exclude_dir/lib.h b/infer/tests/build_systems/codetoanalyze/clang_translation/src/exclude_dir/lib.h new file mode 100644 index 000000000..e80e48b1f --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/exclude_dir/lib.h @@ -0,0 +1,13 @@ +/* + * 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. + */ + +#pragma once +namespace internal_exclude { +int fun(int a) { return a; } +} diff --git a/infer/tests/build_systems/codetoanalyze/clang_translation/src/external b/infer/tests/build_systems/codetoanalyze/clang_translation/src/external new file mode 120000 index 000000000..aa6675da6 --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/external @@ -0,0 +1 @@ +../external_dir/ \ No newline at end of file diff --git a/infer/tests/build_systems/codetoanalyze/clang_translation/src/main.cpp b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main.cpp new file mode 100644 index 000000000..44bd69cce --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main.cpp @@ -0,0 +1,24 @@ +/* + * 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 +#include + +#include "project_lib.h" +#include "external/external_lib.h" +#include "exclude_dir/lib.h" + +int main() { + internal::fun(1); // internal::fun definition should be translated + internal_exclude::fun(1); // internal_exclude::fun shouldn't be translated + external::fun(1); // external::fun definition shouldn't be translated + std::shared_ptr x; // shared_ptr::shared_ptr model should be translated + std::string s("1234"); // string::string shouldn't be translated (there is no + // model for it) +} 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 new file mode 100644 index 000000000..8f833e66e --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main.cpp.dot @@ -0,0 +1,89 @@ +/* @generated */ +digraph iCFG { +"internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_3" [label="3: Return Stmt \n n$0=*&a:int [line 12]\n *&return:int =n$0 [line 12]\n " shape="box"] + + + "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_3" -> "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_2" ; +"internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_2" [label="2: Exit internal::fun \n " color=yellow style=filled] + + +"internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_1" [label="1: Start internal::fun\nFormals: a:int \nLocals: \n DECLARE_LOCALS(&return); [line 12]\n " color=yellow style=filled] + + + "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_1" -> "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_3" ; +"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" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_2" ; +"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_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" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" ; +"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_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_2" ; +"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_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_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" ; +"main.fad58de7366495db4650cfefac2fcd61_7" [label="7: Call _fun_internal::fun \n n$3=_fun_internal::fun(1:int ) [line 18]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_7" -> "main.fad58de7366495db4650cfefac2fcd61_6" ; +"main.fad58de7366495db4650cfefac2fcd61_6" [label="6: Call _fun_internal_exclude::fun \n n$2=_fun_internal_exclude::fun(1:int ) [line 19]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_6" -> "main.fad58de7366495db4650cfefac2fcd61_5" ; +"main.fad58de7366495db4650cfefac2fcd61_5" [label="5: Call _fun_external::fun \n n$1=_fun_external::fun(1:int ) [line 20]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_5" -> "main.fad58de7366495db4650cfefac2fcd61_4" ; +"main.fad58de7366495db4650cfefac2fcd61_4" [label="4: DeclStmt \n _fun_std::__1::shared_ptr_shared_ptr(&x:int **) [line 21]\n n$0=*&x:int * [line 21]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_4" -> "main.fad58de7366495db4650cfefac2fcd61_3" ; +"main.fad58de7366495db4650cfefac2fcd61_3" [label="3: DeclStmt \n _fun_std::__1::basic_string<8d2d7b7b909d4c24>_basic_string(&s:class std::__1::basic_string<8d2d7b7b909d4c24> *,\"1234\":char *) [line 22]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_3" -> "main.fad58de7366495db4650cfefac2fcd61_2" ; +"main.fad58de7366495db4650cfefac2fcd61_2" [label="2: Exit main \n " color=yellow style=filled] + + +"main.fad58de7366495db4650cfefac2fcd61_1" [label="1: Start main\nFormals: \nLocals: s:class std::__1::basic_string<8d2d7b7b909d4c24> x:int * \n DECLARE_LOCALS(&return,&s,&x); [line 17]\n " color=yellow style=filled] + + + "main.fad58de7366495db4650cfefac2fcd61_1" -> "main.fad58de7366495db4650cfefac2fcd61_7" ; +"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" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_2" ; +"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_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" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_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}.2e163b5142d39d575d5eeb568316078d_4" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_3" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_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}.2e163b5142d39d575d5eeb568316078d_3" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_2" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_2" [label="2: Exit std::__1::shared_ptr_shared_ptr \n " color=yellow style=filled] + + +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_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_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_1" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_4" ; +} diff --git a/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_root.cpp b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_root.cpp new file mode 120000 index 000000000..74bdb1a4e --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_root.cpp @@ -0,0 +1 @@ +main.cpp \ No newline at end of file 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 new file mode 100644 index 000000000..8f833e66e --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_root.cpp.dot @@ -0,0 +1,89 @@ +/* @generated */ +digraph iCFG { +"internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_3" [label="3: Return Stmt \n n$0=*&a:int [line 12]\n *&return:int =n$0 [line 12]\n " shape="box"] + + + "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_3" -> "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_2" ; +"internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_2" [label="2: Exit internal::fun \n " color=yellow style=filled] + + +"internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_1" [label="1: Start internal::fun\nFormals: a:int \nLocals: \n DECLARE_LOCALS(&return); [line 12]\n " color=yellow style=filled] + + + "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_1" -> "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_3" ; +"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" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_2" ; +"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_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" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" ; +"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_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_2" ; +"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_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_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" ; +"main.fad58de7366495db4650cfefac2fcd61_7" [label="7: Call _fun_internal::fun \n n$3=_fun_internal::fun(1:int ) [line 18]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_7" -> "main.fad58de7366495db4650cfefac2fcd61_6" ; +"main.fad58de7366495db4650cfefac2fcd61_6" [label="6: Call _fun_internal_exclude::fun \n n$2=_fun_internal_exclude::fun(1:int ) [line 19]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_6" -> "main.fad58de7366495db4650cfefac2fcd61_5" ; +"main.fad58de7366495db4650cfefac2fcd61_5" [label="5: Call _fun_external::fun \n n$1=_fun_external::fun(1:int ) [line 20]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_5" -> "main.fad58de7366495db4650cfefac2fcd61_4" ; +"main.fad58de7366495db4650cfefac2fcd61_4" [label="4: DeclStmt \n _fun_std::__1::shared_ptr_shared_ptr(&x:int **) [line 21]\n n$0=*&x:int * [line 21]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_4" -> "main.fad58de7366495db4650cfefac2fcd61_3" ; +"main.fad58de7366495db4650cfefac2fcd61_3" [label="3: DeclStmt \n _fun_std::__1::basic_string<8d2d7b7b909d4c24>_basic_string(&s:class std::__1::basic_string<8d2d7b7b909d4c24> *,\"1234\":char *) [line 22]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_3" -> "main.fad58de7366495db4650cfefac2fcd61_2" ; +"main.fad58de7366495db4650cfefac2fcd61_2" [label="2: Exit main \n " color=yellow style=filled] + + +"main.fad58de7366495db4650cfefac2fcd61_1" [label="1: Start main\nFormals: \nLocals: s:class std::__1::basic_string<8d2d7b7b909d4c24> x:int * \n DECLARE_LOCALS(&return,&s,&x); [line 17]\n " color=yellow style=filled] + + + "main.fad58de7366495db4650cfefac2fcd61_1" -> "main.fad58de7366495db4650cfefac2fcd61_7" ; +"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" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_2" ; +"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_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" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_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}.2e163b5142d39d575d5eeb568316078d_4" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_3" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_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}.2e163b5142d39d575d5eeb568316078d_3" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_2" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_2" [label="2: Exit std::__1::shared_ptr_shared_ptr \n " color=yellow style=filled] + + +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_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_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_1" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_4" ; +} diff --git a/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_symlink.cpp b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_symlink.cpp new file mode 120000 index 000000000..74bdb1a4e --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_symlink.cpp @@ -0,0 +1 @@ +main.cpp \ No newline at end of file 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 new file mode 100644 index 000000000..8f833e66e --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_default_symlink.cpp.dot @@ -0,0 +1,89 @@ +/* @generated */ +digraph iCFG { +"internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_3" [label="3: Return Stmt \n n$0=*&a:int [line 12]\n *&return:int =n$0 [line 12]\n " shape="box"] + + + "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_3" -> "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_2" ; +"internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_2" [label="2: Exit internal::fun \n " color=yellow style=filled] + + +"internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_1" [label="1: Start internal::fun\nFormals: a:int \nLocals: \n DECLARE_LOCALS(&return); [line 12]\n " color=yellow style=filled] + + + "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_1" -> "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_3" ; +"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" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_2" ; +"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_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" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" ; +"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_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_2" ; +"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_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_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" ; +"main.fad58de7366495db4650cfefac2fcd61_7" [label="7: Call _fun_internal::fun \n n$3=_fun_internal::fun(1:int ) [line 18]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_7" -> "main.fad58de7366495db4650cfefac2fcd61_6" ; +"main.fad58de7366495db4650cfefac2fcd61_6" [label="6: Call _fun_internal_exclude::fun \n n$2=_fun_internal_exclude::fun(1:int ) [line 19]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_6" -> "main.fad58de7366495db4650cfefac2fcd61_5" ; +"main.fad58de7366495db4650cfefac2fcd61_5" [label="5: Call _fun_external::fun \n n$1=_fun_external::fun(1:int ) [line 20]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_5" -> "main.fad58de7366495db4650cfefac2fcd61_4" ; +"main.fad58de7366495db4650cfefac2fcd61_4" [label="4: DeclStmt \n _fun_std::__1::shared_ptr_shared_ptr(&x:int **) [line 21]\n n$0=*&x:int * [line 21]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_4" -> "main.fad58de7366495db4650cfefac2fcd61_3" ; +"main.fad58de7366495db4650cfefac2fcd61_3" [label="3: DeclStmt \n _fun_std::__1::basic_string<8d2d7b7b909d4c24>_basic_string(&s:class std::__1::basic_string<8d2d7b7b909d4c24> *,\"1234\":char *) [line 22]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_3" -> "main.fad58de7366495db4650cfefac2fcd61_2" ; +"main.fad58de7366495db4650cfefac2fcd61_2" [label="2: Exit main \n " color=yellow style=filled] + + +"main.fad58de7366495db4650cfefac2fcd61_1" [label="1: Start main\nFormals: \nLocals: s:class std::__1::basic_string<8d2d7b7b909d4c24> x:int * \n DECLARE_LOCALS(&return,&s,&x); [line 17]\n " color=yellow style=filled] + + + "main.fad58de7366495db4650cfefac2fcd61_1" -> "main.fad58de7366495db4650cfefac2fcd61_7" ; +"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" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_2" ; +"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_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" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_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}.2e163b5142d39d575d5eeb568316078d_4" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_3" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_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}.2e163b5142d39d575d5eeb568316078d_3" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_2" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_2" [label="2: Exit std::__1::shared_ptr_shared_ptr \n " color=yellow style=filled] + + +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_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_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_1" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_4" ; +} diff --git a/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_symlink.cpp b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_symlink.cpp new file mode 120000 index 000000000..74bdb1a4e --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_symlink.cpp @@ -0,0 +1 @@ +main.cpp \ No newline at end of file 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 new file mode 100644 index 000000000..8f833e66e --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/main_symlink.cpp.dot @@ -0,0 +1,89 @@ +/* @generated */ +digraph iCFG { +"internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_3" [label="3: Return Stmt \n n$0=*&a:int [line 12]\n *&return:int =n$0 [line 12]\n " shape="box"] + + + "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_3" -> "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_2" ; +"internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_2" [label="2: Exit internal::fun \n " color=yellow style=filled] + + +"internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_1" [label="1: Start internal::fun\nFormals: a:int \nLocals: \n DECLARE_LOCALS(&return); [line 12]\n " color=yellow style=filled] + + + "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_1" -> "internal::fun{d41d8cd98f00b204e9800998ecf8427e_ZN8internal3funEi}.85135ab105a259368b1d7ebf1f3d3ac2_3" ; +"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" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_2" ; +"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_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" -> "std::__1::shared_ptr_~shared_ptr(_ZNSt3__110shared_ptrIiED0Ev).388e7f06faa2f498fd08f3d3c50ca31a_3" ; +"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_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_2" ; +"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_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_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_1" -> "std::__1::shared_ptr_model_set(_ZNSt3__110shared_ptrIiE9model_setEPPKvS3_).c02dbe299962364cf3c5255e9c8d287d_3" ; +"main.fad58de7366495db4650cfefac2fcd61_7" [label="7: Call _fun_internal::fun \n n$3=_fun_internal::fun(1:int ) [line 18]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_7" -> "main.fad58de7366495db4650cfefac2fcd61_6" ; +"main.fad58de7366495db4650cfefac2fcd61_6" [label="6: Call _fun_internal_exclude::fun \n n$2=_fun_internal_exclude::fun(1:int ) [line 19]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_6" -> "main.fad58de7366495db4650cfefac2fcd61_5" ; +"main.fad58de7366495db4650cfefac2fcd61_5" [label="5: Call _fun_external::fun \n n$1=_fun_external::fun(1:int ) [line 20]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_5" -> "main.fad58de7366495db4650cfefac2fcd61_4" ; +"main.fad58de7366495db4650cfefac2fcd61_4" [label="4: DeclStmt \n _fun_std::__1::shared_ptr_shared_ptr(&x:int **) [line 21]\n n$0=*&x:int * [line 21]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_4" -> "main.fad58de7366495db4650cfefac2fcd61_3" ; +"main.fad58de7366495db4650cfefac2fcd61_3" [label="3: DeclStmt \n _fun_std::__1::basic_string<8d2d7b7b909d4c24>_basic_string(&s:class std::__1::basic_string<8d2d7b7b909d4c24> *,\"1234\":char *) [line 22]\n " shape="box"] + + + "main.fad58de7366495db4650cfefac2fcd61_3" -> "main.fad58de7366495db4650cfefac2fcd61_2" ; +"main.fad58de7366495db4650cfefac2fcd61_2" [label="2: Exit main \n " color=yellow style=filled] + + +"main.fad58de7366495db4650cfefac2fcd61_1" [label="1: Start main\nFormals: \nLocals: s:class std::__1::basic_string<8d2d7b7b909d4c24> x:int * \n DECLARE_LOCALS(&return,&s,&x); [line 17]\n " color=yellow style=filled] + + + "main.fad58de7366495db4650cfefac2fcd61_1" -> "main.fad58de7366495db4650cfefac2fcd61_7" ; +"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" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_2" ; +"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_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" -> "std::__1::shared_ptr_reset(_ZNSt3__110shared_ptrIiE5resetIivEEvPT_).29e462552cba695192437aa4bfbf146e_3" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_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}.2e163b5142d39d575d5eeb568316078d_4" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_3" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_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}.2e163b5142d39d575d5eeb568316078d_3" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_2" ; +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_2" [label="2: Exit std::__1::shared_ptr_shared_ptr \n " color=yellow style=filled] + + +"std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_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_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_1" -> "std::__1::shared_ptr_shared_ptr{_ZNSt3__110shared_ptrIiEC1Ev}.2e163b5142d39d575d5eeb568316078d_4" ; +} diff --git a/infer/tests/build_systems/codetoanalyze/clang_translation/src/project_lib.h b/infer/tests/build_systems/codetoanalyze/clang_translation/src/project_lib.h new file mode 100644 index 000000000..8b8c4aa87 --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/src/project_lib.h @@ -0,0 +1,16 @@ +/* + * 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. + */ + +#pragma once +namespace internal { +int fun(int a) { return a; } + +// function shouldn't be translated if it's not used in source file +int unused(int a) { return a; } +} diff --git a/infer/tests/build_systems/codetoanalyze/clang_translation/tsrc_symlink b/infer/tests/build_systems/codetoanalyze/clang_translation/tsrc_symlink new file mode 120000 index 000000000..e8310385c --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/clang_translation/tsrc_symlink @@ -0,0 +1 @@ +src \ No newline at end of file