Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("//cpp/libclang/integration_test:test_rules.bzl", "cpp_parser_integration_test")

cc_library(
name = "template_partial_specialization_ids",
srcs = ["specialization.cpp"],
hdrs = [
"specialization.h",
"specialization_with_return.h",
"specialization_without_return.h",
],
visibility = ["//cpp/libclang:__subpackages__"],
)

cpp_parser_integration_test(
name = "test_template_partial_specialization_ids",
expected_output = ["expected.json"],
target = ":template_partial_specialization_ids",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
{
"functions": [],
"types": {
"demo::Endpoint<ReturnType (ArgTypes...)>": {
"enclosing_namespace_id": "demo",
"entity_type": "Class",
"enum_literals": [],
"id": "demo::Endpoint<ReturnType (ArgTypes...)>",
"methods": [
{
"modifiers": [],
"name": "Request",
"parameters": [
{
"is_pack_expansion": true,
"is_variadic": false,
"name": "args",
"param_type": "const ArgTypes &"
}
],
"return_type": "ReturnType",
"template_parameters": null,
"visibility": "public",
"source_location": {
"file": "./cpp/libclang/integration_test/cases/template_partial_specialization_ids/specialization_with_return.h",
"line": 28
}
}
],
"name": "Endpoint",
"relationships": [],
"source_location": {
"file": "./cpp/libclang/integration_test/cases/template_partial_specialization_ids/specialization_with_return.h",
"line": 25
},
"template_parameters": [
{
"Type": {
"is_pack": false,
"name": "ReturnType"
}
},
{
"Type": {
"is_pack": true,
"name": "ArgTypes"
}
}
],
"type_aliases": [],
"variables": [
{
"data_type": "int",
"is_static": false,
"name": "parameter_count_",
"source_location": {
"file": "./cpp/libclang/integration_test/cases/template_partial_specialization_ids/specialization_with_return.h",
"line": 31
},
"visibility": "private"
}
]
},
"demo::Endpoint<void (ArgTypes...)>": {
"enclosing_namespace_id": "demo",
"entity_type": "Class",
"enum_literals": [],
"id": "demo::Endpoint<void (ArgTypes...)>",
"methods": [
{
"modifiers": [],
"name": "Notify",
"parameters": [
{
"is_pack_expansion": true,
"is_variadic": false,
"name": "args",
"param_type": "const ArgTypes &"
}
],
"return_type": "void",
"template_parameters": null,
"visibility": "public",
"source_location": {
"file": "./cpp/libclang/integration_test/cases/template_partial_specialization_ids/specialization_without_return.h",
"line": 28
}
}
],
"name": "Endpoint",
"relationships": [],
"source_location": {
"file": "./cpp/libclang/integration_test/cases/template_partial_specialization_ids/specialization_without_return.h",
"line": 25
},
"template_parameters": [
{
"Type": {
"is_pack": true,
"name": "ArgTypes"
}
}
],
"type_aliases": [],
"variables": [
{
"data_type": "int",
"is_static": false,
"name": "notification_count_",
"source_location": {
"file": "./cpp/libclang/integration_test/cases/template_partial_specialization_ids/specialization_without_return.h",
"line": 31
},
"visibility": "private"
}
]
},
"demo::Endpoint": {
"enclosing_namespace_id": "demo",
"entity_type": "Class",
"enum_literals": [],
"id": "demo::Endpoint",
"methods": [],
"name": "Endpoint",
"relationships": [],
"source_location": {
"file": "./cpp/libclang/integration_test/cases/template_partial_specialization_ids/specialization.h",
"line": 23
},
"template_parameters": [
{
"Type": {
"is_pack": false,
"name": "Signature"
}
}
],
"type_aliases": [],
"variables": []
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// *******************************************************************************
// Copyright (c) 2026 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// This program and the accompanying materials are made available under the
// terms of the Apache License Version 2.0 which is available at
// <https://www.apache.org/licenses/LICENSE-2.0>
//
// SPDX-License-Identifier: Apache-2.0
// *******************************************************************************

use test_framework::run_parser_case;

#[test]
fn test_template_partial_specialization_ids() {
run_parser_case();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/********************************************************************************
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

#include "specialization_with_return.h"
#include "specialization_without_return.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/********************************************************************************
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

#ifndef CPP_LIBCLANG_INTEGRATION_TEST_CASES_TEMPLATE_PARTIAL_SPECIALIZATION_IDS_SPECIALIZATION_H
#define CPP_LIBCLANG_INTEGRATION_TEST_CASES_TEMPLATE_PARTIAL_SPECIALIZATION_IDS_SPECIALIZATION_H

namespace demo
{

// Primary template kept in its own header so the parser has to merge it with
// function-signature partial specializations declared elsewhere.
template <typename Signature>
class Endpoint
{
static_assert(sizeof(Signature) == 0, "Endpoint only supports function-signature template arguments.");
};

} // namespace demo

#endif // CPP_LIBCLANG_INTEGRATION_TEST_CASES_TEMPLATE_PARTIAL_SPECIALIZATION_IDS_SPECIALIZATION_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/********************************************************************************
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

#ifndef CPP_LIBCLANG_INTEGRATION_TEST_CASES_TEMPLATE_PARTIAL_SPECIALIZATION_IDS_SPECIALIZATION_WITH_RETURN_H
#define CPP_LIBCLANG_INTEGRATION_TEST_CASES_TEMPLATE_PARTIAL_SPECIALIZATION_IDS_SPECIALIZATION_WITH_RETURN_H

#include "specialization.h"

namespace demo
{

// Covers a partial specialization that binds both a regular template parameter
// and a parameter pack from a function-signature template argument.
template <typename ReturnType, typename... ArgTypes>
class Endpoint<ReturnType(ArgTypes...)>
{
public:
ReturnType Request(const ArgTypes&... args);

private:
int parameter_count_;
};

} // namespace demo

#endif // CPP_LIBCLANG_INTEGRATION_TEST_CASES_TEMPLATE_PARTIAL_SPECIALIZATION_IDS_SPECIALIZATION_WITH_RETURN_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/********************************************************************************
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

#ifndef CPP_LIBCLANG_INTEGRATION_TEST_CASES_TEMPLATE_PARTIAL_SPECIALIZATION_IDS_SPECIALIZATION_WITHOUT_RETURN_H
#define CPP_LIBCLANG_INTEGRATION_TEST_CASES_TEMPLATE_PARTIAL_SPECIALIZATION_IDS_SPECIALIZATION_WITHOUT_RETURN_H

#include "specialization.h"

namespace demo
{

// Mirrors the void-return specialization pattern used by ProxyMethod and keeps
// the parameter pack in the specialization itself.
template <typename... ArgTypes>
class Endpoint<void(ArgTypes...)>
{
public:
void Notify(const ArgTypes&... args);

private:
int notification_count_;
};

} // namespace demo

#endif // CPP_LIBCLANG_INTEGRATION_TEST_CASES_TEMPLATE_PARTIAL_SPECIALIZATION_IDS_SPECIALIZATION_WITHOUT_RETURN_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("//cpp/libclang/integration_test:test_rules.bzl", "cpp_parser_integration_test")

cc_library(
name = "template_partial_specialization_relationship_target",
srcs = ["relationship.cpp"],
hdrs = [
"endpoint.h",
"endpoint_without_return.h",
"holder.h",
],
visibility = ["//cpp/libclang:__subpackages__"],
)

cpp_parser_integration_test(
name = "test_template_partial_specialization_relationship_target",
expected_output = ["expected.json"],
target = ":template_partial_specialization_relationship_target",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/********************************************************************************
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

#ifndef CPP_LIBCLANG_INTEGRATION_TEST_CASES_TEMPLATE_PARTIAL_SPECIALIZATION_RELATIONSHIP_TARGET_ENDPOINT_H
#define CPP_LIBCLANG_INTEGRATION_TEST_CASES_TEMPLATE_PARTIAL_SPECIALIZATION_RELATIONSHIP_TARGET_ENDPOINT_H

namespace demo
{

// Primary template exists as a distinct entity, and the relationship logic
// currently prefers this template base over a concrete specialization target.
template <typename Signature>
class Endpoint
{
static_assert(sizeof(Signature) == 0, "Endpoint only supports function-signature template arguments.");
};

} // namespace demo

#endif // CPP_LIBCLANG_INTEGRATION_TEST_CASES_TEMPLATE_PARTIAL_SPECIALIZATION_RELATIONSHIP_TARGET_ENDPOINT_H
Loading
Loading