Skip to content

Conversation

@aaronj0
Copy link
Collaborator

@aaronj0 aaronj0 commented Jan 2, 2026

Drops common Cpp namespace used for both public API, and internal facilities.
With this patch, we introduce a CppInternal (open to better suggestions) namespace that contains private classes that are not meant to be exposed

-- Cpp
     - Public API
     - JitCall
-- CppInternal
     - Interpreter
     - DynamicLibraryManager
     - utils
        - platform
        - SplitMode
        - Lookup
        + everything in cling::utils if Cling

As a result we no longer perform the following unintuitive remap:

namespace Cpp {
namespace Cpp_utils = Cpp::utils;
}

and the distinction between public API (everything in include/CppInterOp.h) and other implementation facilities are clear

@aaronj0 aaronj0 requested a review from vgvassilev January 2, 2026 22:37
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions


auto& S = getInterpreter(parent)->getSema();
auto* ND = Cpp::Cpp_utils::Lookup::Named(&S, name, Within);
auto* ND = CppInternal::utils::Lookup::Named(&S, name, Within);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "CppInternal::utils::Lookup::Named" is directly included [misc-include-cleaner]

lib/CppInterOp/CXCppInterOp.cpp:4:

- #include "clang/AST/CXXInheritance.h"
+ #include "CppInterOpInterpreter.h"
+ #include "clang/AST/CXXInheritance.h"


namespace compat {
using Interpreter = Cpp::Interpreter;
using Interpreter = CppInternal::Interpreter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no type named 'Interpreter' in namespace 'CppInternal'; did you mean 'clang::Interpreter'? [clang-diagnostic-error]

Suggested change
using Interpreter = CppInternal::Interpreter;
using Interpreter = clang::Interpreter;
Additional context

llvm/include/clang/Interpreter/Interpreter.h:85: 'clang::Interpreter' declared here

class Interpreter {
      ^

}

auto* ND = Cpp_utils::Lookup::Named(&getSema(), name, Within);
auto* ND = CppInternal::utils::Lookup::Named(&getSema(), name, Within);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "CppInternal::utils::Lookup::Named" is directly included [misc-include-cleaner]

lib/CppInterOp/CppInterOp.cpp:12:

+ #include "CppInterOpInterpreter.h"

For_Visible_Redeclaration);

Cpp_utils::Lookup::Named(&S, R, Decl::castToDeclContext(D));
CppInternal::utils::Lookup::Named(&S, R, Decl::castToDeclContext(D));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "CppInternal::utils::Lookup::Named" is directly included [misc-include-cleaner]

  CppInternal::utils::Lookup::Named(&S, R, Decl::castToDeclContext(D));
                              ^

namespace Cpp {
namespace CppInternal {
namespace utils {
namespace Lookup {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]

Suggested change
namespace Lookup {
namespace CppInternal::utils::Lookup {

lib/CppInterOp/CppInterOpInterpreter.h:141:

- } // namespace Lookup
- } // namespace utils
- } // namespace CppInternal
+ } // namespace CppInternal::utils::Lookup
+ 

bool m_UseHashTable = true;

const Cpp::DynamicLibraryManager& m_DynamicLibraryManager;
const DynamicLibraryManager& m_DynamicLibraryManager;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: member 'm_DynamicLibraryManager' of type 'const DynamicLibraryManager &' is a reference [cppcoreguidelines-avoid-const-or-ref-data-members]

  const DynamicLibraryManager& m_DynamicLibraryManager;
                               ^

case ELF::DT_RPATH:
SplitPaths(Data + Dyn.d_un.d_val, RPath, utils::kAllowNonExistent,
Cpp::utils::platform::kEnvDelim, false);
SplitPaths(Data + Dyn.d_un.d_val, RPath,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]

      SplitPaths(Data + Dyn.d_un.d_val, RPath,
                                 ^

case ELF::DT_RUNPATH:
SplitPaths(Data + Dyn.d_un.d_val, RunPath, utils::kAllowNonExistent,
Cpp::utils::platform::kEnvDelim, false);
SplitPaths(Data + Dyn.d_un.d_val, RunPath,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]

      SplitPaths(Data + Dyn.d_un.d_val, RunPath,
                                 ^


namespace Cpp {
namespace CppInternal {
namespace utils {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]

Suggested change
namespace utils {
namespace CppInternal::utils {

lib/CppInterOp/Paths.cpp:400:

- } // namespace utils
- } // namespace CppInternal
+ } // namespace CppInternal::utils


namespace Cpp {
namespace CppInternal {
namespace utils {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]

Suggested change
namespace utils {
namespace CppInternal::utils {

lib/CppInterOp/Paths.h:119:

- } // namespace utils
- } // namespace CppInternal
+ } // namespace CppInternal::utils

@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.09%. Comparing base (0e12503) to head (58d080a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/CppInterOp/DynamicLibraryManagerSymbol.cpp 80.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #766   +/-   ##
=======================================
  Coverage   79.09%   79.09%           
=======================================
  Files           9        9           
  Lines        3898     3898           
=======================================
  Hits         3083     3083           
  Misses        815      815           
Files with missing lines Coverage Δ
lib/CppInterOp/CXCppInterOp.cpp 48.09% <100.00%> (ø)
lib/CppInterOp/Compatibility.h 87.39% <ø> (ø)
lib/CppInterOp/CppInterOp.cpp 87.62% <100.00%> (ø)
lib/CppInterOp/CppInterOpInterpreter.h 83.18% <100.00%> (ø)
lib/CppInterOp/DynamicLibraryManager.cpp 71.97% <100.00%> (ø)
lib/CppInterOp/DynamicLibraryManager.h 90.00% <ø> (ø)
lib/CppInterOp/Paths.cpp 65.05% <ø> (ø)
lib/CppInterOp/DynamicLibraryManagerSymbol.cpp 67.23% <80.00%> (ø)
Files with missing lines Coverage Δ
lib/CppInterOp/CXCppInterOp.cpp 48.09% <100.00%> (ø)
lib/CppInterOp/Compatibility.h 87.39% <ø> (ø)
lib/CppInterOp/CppInterOp.cpp 87.62% <100.00%> (ø)
lib/CppInterOp/CppInterOpInterpreter.h 83.18% <100.00%> (ø)
lib/CppInterOp/DynamicLibraryManager.cpp 71.97% <100.00%> (ø)
lib/CppInterOp/DynamicLibraryManager.h 90.00% <ø> (ø)
lib/CppInterOp/Paths.cpp 65.05% <ø> (ø)
lib/CppInterOp/DynamicLibraryManagerSymbol.cpp 67.23% <80.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

@aaronj0 aaronj0 merged commit 1d2e8c1 into compiler-research:main Jan 3, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants