[CType_decl] Add missing case to `get_record_typename`

Reviewed By: ddino

Differential Revision: D13736334

fbshipit-source-id: c088d1aa8
master
David Lively 6 years ago committed by Facebook Github Bot
parent 5686d67072
commit d390a6f08a

@ -457,6 +457,7 @@ and get_record_typename ?tenv decl =
| CXXRecordDecl (_, name_info, _, _, _, `TTK_Union, _, _), _ -> | CXXRecordDecl (_, name_info, _, _, _, `TTK_Union, _, _), _ ->
Typ.CUnion (CAst_utils.get_qualified_name ~linters_mode name_info) Typ.CUnion (CAst_utils.get_qualified_name ~linters_mode name_info)
| CXXRecordDecl (_, name_info, _, _, _, _, _, _), _ | CXXRecordDecl (_, name_info, _, _, _, _, _, _), _
| ClassTemplatePartialSpecializationDecl (_, name_info, _, _, _, _, _, _, _, _), _
| ClassTemplateSpecializationDecl (_, name_info, _, _, _, _, _, _, _, _), _ -> | ClassTemplateSpecializationDecl (_, name_info, _, _, _, _, _, _, _, _), _ ->
(* we use Typ.CppClass for C++ because we expect Typ.CppClass from *) (* we use Typ.CppClass for C++ because we expect Typ.CppClass from *)
(* types that have methods. And in C++ struct/class/union can have methods *) (* types that have methods. And in C++ struct/class/union can have methods *)
@ -475,7 +476,7 @@ and get_record_typename ?tenv decl =
| None -> | None ->
assert false ) assert false )
| _ -> | _ ->
assert false Logging.die InternalError "Unhandled decl: %s." (Clang_ast_proj.get_decl_kind_string decl)
(** fetches list of superclasses for C++ classes *) (** fetches list of superclasses for C++ classes *)

@ -10,9 +10,18 @@ codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Foo::Bar::SvIf_poke,
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Foo::Bar::SvIf_semifuture_poke, 38, FIND_CXX_METHOD_OVERRIDES, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Foo::Bar::SvIf_semifuture_poke, 38, FIND_CXX_METHOD_OVERRIDES, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Foo::Bar::SvIf_semifuture_poke, 38, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Foo::Bar::SvIf_semifuture_poke, 38, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Foo::Bar::SvIf_~SvIf, 34, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Foo::Bar::SvIf_~SvIf, 34, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Foo::SvIf_async_tm_poke, 25, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Foo::SvIf_future_poke, 26, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Foo::SvIf_semifuture_poke, 27, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Foo::SvIf_~SvIf, 24, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, FooBarService_async_tm_poke, 50, FIND_CXX_METHOD_OVERRIDES, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, FooBarService_async_tm_poke, 50, FIND_CXX_METHOD_OVERRIDES, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, FooBarService_future_poke, 51, FIND_CXX_METHOD_OVERRIDES, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, FooBarService_future_poke, 51, FIND_CXX_METHOD_OVERRIDES, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, FooBarService_future_poke, 51, FIND_CXX_METHOD_OVERRIDES_MATCHING, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, FooBarService_future_poke, 51, FIND_CXX_METHOD_OVERRIDES_MATCHING, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, FooBarService_poke, 49, FIND_CXX_METHOD_OVERRIDES, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, FooBarService_poke, 49, FIND_CXX_METHOD_OVERRIDES, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, FooBarService_semifuture_poke, 52, FIND_CXX_METHOD_OVERRIDES, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, FooBarService_semifuture_poke, 52, FIND_CXX_METHOD_OVERRIDES, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Linters_dummy_method, 22, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Linters_dummy_method, 30, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Linters_dummy_method, 32, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, [] codetoanalyze/cpp/linters-for-test-only/test_overrides.cpp, Linters_dummy_method, 32, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_partial_spec_template.cpp, Foo::is_negative_impl_type-parameter-0-0,_false__check, 16, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_partial_spec_template.cpp, Linters_dummy_method, 9, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, []
codetoanalyze/cpp/linters-for-test-only/test_partial_spec_template.cpp, Linters_dummy_method, 14, FIND_NODES_WITH_CXX_FULL_NAME, no_bucket, WARNING, []

@ -39,6 +39,6 @@ DEFINE-CHECKER FIND_CXX_METHOD_OVERRIDES_MATCHING = {
}; };
DEFINE-CHECKER FIND_NODES_WITH_CXX_FULL_NAME = { DEFINE-CHECKER FIND_NODES_WITH_CXX_FULL_NAME = {
SET report_when = has_cxx_fully_qualified_name(REGEXP("::Foo::Bar::")); SET report_when = has_cxx_fully_qualified_name(REGEXP("::Foo::.*"));
SET message = "%cxx_fully_qualified_name% matches"; SET message = "%cxx_fully_qualified_name% matches";
}; };

@ -0,0 +1,19 @@
/*
* Copyright (c) 2019-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
namespace Foo {
template <typename T, bool>
struct is_negative_impl {
constexpr static bool check(T x) { return x < 0; }
};
template <typename T>
struct is_negative_impl<T, false> {
constexpr static bool check(T) { return false; }
};
} // namespace Foo
Loading…
Cancel
Save