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
25 changes: 25 additions & 0 deletions cpp/libclang/integration_test/cases/nested_type_relationship/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# *******************************************************************************
# 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 = "nested_type_relationship",
srcs = ["transport.cpp"],
visibility = ["//cpp/libclang:__subpackages__"],
)

cpp_parser_integration_test(
name = "test_nested_type_relationship",
expected_output = ["expected.json"],
target = ":nested_type_relationship",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"types": {
"demo::Consumer": {
"id": "demo::Consumer",
"name": "Consumer",
"enclosing_namespace_id": "demo",
"entity_type": "Class",
"enum_literals": [],
"methods": [],
"relationships": [
{
"source": "demo::Consumer",
"target": "demo::Outer::Inner",
"relation_type": "Composition",
"source_multiplicity": null,
"target_multiplicity": null,
"source_location": {
"file": "",
"line": 23
}
}
],
"template_parameters": null,
"type_aliases": [],
"variables": [
{
"name": "inner_",
"data_type": "demo::Outer::Inner",
"is_static": false,
"visibility": "private",
"source_location": {
"file": "",
"line": 23
}
}
],
"source_location": {
"file": "cpp/libclang/integration_test/cases/nested_type_relationship/transport.cpp",
"line": 21
}
},
"demo::Outer": {
"id": "demo::Outer",
"name": "Outer",
"enclosing_namespace_id": "demo",
"entity_type": "Class",
"enum_literals": [],
"methods": [],
"relationships": [],
"template_parameters": null,
"type_aliases": [],
"variables": [],
"source_location": {
"file": "cpp/libclang/integration_test/cases/nested_type_relationship/transport.cpp",
"line": 16
}
},
"demo::Outer::Inner": {
"id": "demo::Outer::Inner",
"name": "Inner",
"enclosing_namespace_id": "demo",
"entity_type": "Class",
"enum_literals": [],
"methods": [],
"relationships": [],
"template_parameters": null,
"type_aliases": [],
"variables": [],
"source_location": {
"file": "cpp/libclang/integration_test/cases/nested_type_relationship/transport.cpp",
"line": 18
}
}
},
"functions": []
}
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_nested_type_relationship() {
run_parser_case();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/********************************************************************************
* 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
********************************************************************************/

namespace demo {

class Outer {
public:
class Inner {};
};

class Consumer {
private:
Outer::Inner inner_;
};

} // namespace demo
30 changes: 30 additions & 0 deletions cpp/libclang/src/semantics/BUILD
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("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

rust_library(
name = "cpp_semantics",
srcs = [
"src/lib.rs",
"src/resolved_type.rs",
],
visibility = ["//cpp/libclang:__subpackages__"],
deps = ["@crates//:serde"],
)

rust_test(
name = "resolved_type_test",
srcs = ["src/resolved_type.rs"],
deps = ["@crates//:serde"],
)
16 changes: 16 additions & 0 deletions cpp/libclang/src/semantics/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// *******************************************************************************
// 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
// *******************************************************************************

mod resolved_type;

pub use resolved_type::{EntityId, ResolvedType};
Loading
Loading