From 44fb635a901015042a166cede7101d8bab68aa83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Thu, 25 Oct 2018 22:09:09 +0200 Subject: [PATCH] Handle upstream fix for #1 in tests --- test/cpp_type_alias.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/test/cpp_type_alias.cpp b/test/cpp_type_alias.cpp index d7492ba..7d6771e 100644 --- a/test/cpp_type_alias.cpp +++ b/test/cpp_type_alias.cpp @@ -474,15 +474,23 @@ typedef decltype(0) w; } else if (alias.name() == "s") { + // in old libclang version, the member type isn't exposed for some reason auto pointee = cpp_member_object_type::build(cpp_user_defined_type::build( cpp_type_ref(cpp_entity_id(""), "foo")), - cpp_unexposed_type::build( - "int")); // type not exposed directly for some - // reason - auto type = cpp_pointer_type::build(std::move(pointee)); + cpp_unexposed_type::build("int")); + auto type = cpp_pointer_type::build(std::move(pointee)); + auto is_unexposed = equal_types(idx, alias.underlying_type(), *type); - REQUIRE(equal_types(idx, alias.underlying_type(), *type)); + if (!is_unexposed) + { + pointee = cpp_member_object_type::build(cpp_user_defined_type::build( + cpp_type_ref(cpp_entity_id(""), "foo")), + cpp_builtin_type::build(cpp_int)); + type = cpp_pointer_type::build(std::move(pointee)); + auto is_builtin = equal_types(idx, alias.underlying_type(), *type); + REQUIRE(is_builtin); + } } else if (alias.name() == "t") {