From 692a844e0c68950ab1c9bb41c4f3061629c759bc Mon Sep 17 00:00:00 2001 From: David Lively Date: Fri, 15 Mar 2019 09:30:51 -0700 Subject: [PATCH] [AL] use found_decl_ref in recently added predicates/placeholders Reviewed By: ddino Differential Revision: D14421509 fbshipit-source-id: 86826590b --- infer/src/clang/ctl_parser_types.ml | 2 ++ .../codetoanalyze/cpp/linters-for-test-only/issues.exp | 2 ++ .../codetoanalyze/cpp/linters-for-test-only/test_included.h | 2 ++ .../cpp/linters-for-test-only/test_includer.cpp | 6 ++++++ 4 files changed, 12 insertions(+) diff --git a/infer/src/clang/ctl_parser_types.ml b/infer/src/clang/ctl_parser_types.ml index 74b94e29c..03caae476 100644 --- a/infer/src/clang/ctl_parser_types.ml +++ b/infer/src/clang/ctl_parser_types.ml @@ -96,6 +96,7 @@ let ast_node_cxx_fully_qualified_name an = match an with | Decl decl -> decl_cxx_fully_qualified_name decl + | Stmt (DeclRefExpr (_, _, _, {drti_found_decl_ref= Some dr})) | Stmt (DeclRefExpr (_, _, _, {drti_decl_ref= Some dr})) -> Option.value_map ~f:decl_cxx_fully_qualified_name ~default:"" (CAst_utils.get_decl dr.dr_decl_pointer) @@ -633,6 +634,7 @@ let get_decl_ref_source_file (dr : Clang_ast_t.decl_ref) = let get_referenced_decl_source_file an = let open Clang_ast_t in match an with + | Stmt (DeclRefExpr (_, _, _, {drti_found_decl_ref= Some dr})) | Stmt (DeclRefExpr (_, _, _, {drti_decl_ref= Some dr})) -> get_decl_ref_source_file dr | Stmt stmt -> diff --git a/infer/tests/codetoanalyze/cpp/linters-for-test-only/issues.exp b/infer/tests/codetoanalyze/cpp/linters-for-test-only/issues.exp index 9b3d4ad4b..de69ebea6 100644 --- a/infer/tests/codetoanalyze/cpp/linters-for-test-only/issues.exp +++ b/infer/tests/codetoanalyze/cpp/linters-for-test-only/issues.exp @@ -12,6 +12,8 @@ codetoanalyze/cpp/linters-for-test-only/test_fully_qualified_names.cpp, Linters_ codetoanalyze/cpp/linters-for-test-only/test_fully_qualified_names.cpp, Linters_dummy_method, 39, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_included.h, Bazoo_fibble, 11, FIND_CXX_METHODS_FROM_HEADER_FILE, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_includer.cpp, Bazowey_frazzle, 11, FIND_REF_FROM_SRC_FILE, no_bucket, WARNING, [] +codetoanalyze/cpp/linters-for-test-only/test_includer.cpp, Linters_dummy_method, 15, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, [] +codetoanalyze/cpp/linters-for-test-only/test_includer.cpp, zowie, 18, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, B_bar, 16, FIND_CXX_METHOD_OVERRIDES, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, B_foo, 14, FIND_CXX_METHOD_OVERRIDES, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Foo::Bar::SvIf_async_tm_poke, 36, FIND_CXX_METHOD_OVERRIDES, no_bucket, WARNING, [] diff --git a/infer/tests/codetoanalyze/cpp/linters-for-test-only/test_included.h b/infer/tests/codetoanalyze/cpp/linters-for-test-only/test_included.h index 5b6716c70..830bd1f5f 100644 --- a/infer/tests/codetoanalyze/cpp/linters-for-test-only/test_included.h +++ b/infer/tests/codetoanalyze/cpp/linters-for-test-only/test_included.h @@ -10,3 +10,5 @@ struct Bazoo { void fibble(); }; + +void rabble(); diff --git a/infer/tests/codetoanalyze/cpp/linters-for-test-only/test_includer.cpp b/infer/tests/codetoanalyze/cpp/linters-for-test-only/test_includer.cpp index 804bd868a..59f59a988 100644 --- a/infer/tests/codetoanalyze/cpp/linters-for-test-only/test_includer.cpp +++ b/infer/tests/codetoanalyze/cpp/linters-for-test-only/test_includer.cpp @@ -10,3 +10,9 @@ struct Bazowey { void frazzle() { Bazoo().fibble(); } }; + +namespace Foo { +using ::rabble; +} // namespace Foo + +void zowie() { Foo::rabble(); }