Skip to content

[requires CppInterOp 1.9.0 release] Use Cpp::GetLanguage to set language#462

Draft
mcbarton wants to merge 1 commit intocompiler-research:mainfrom
mcbarton:detect-language-via-cppinterop
Draft

[requires CppInterOp 1.9.0 release] Use Cpp::GetLanguage to set language#462
mcbarton wants to merge 1 commit intocompiler-research:mainfrom
mcbarton:detect-language-via-cppinterop

Conversation

@mcbarton
Copy link
Collaborator

With CppInterOp 1.9.0, an API was created which can detect the language of the interpreter (Cpp::GetLanguage). This PR uses this API to set the language, rather than it being static to C++, which will be incorrect for the C kernels. This PR needs testing and I will check it in the coming days.

@mcbarton mcbarton force-pushed the detect-language-via-cppinterop branch from d1c8afa to be511a4 Compare March 17, 2026 20:40
@mcbarton mcbarton force-pushed the detect-language-via-cppinterop branch from da90ecb to 1c47973 Compare March 17, 2026 20:41
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

//NOLINTNEXTLINE (cppcoreguidelines-pro-bounds-pointer-arithmetic)
createInterpreter(Args(argv ? argv + 1 : argv, argv + argc));
m_version = get_stdopt();
m_language = Cpp::GetLanguage(nullptr);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'm_language' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]

src/xinterpreter.cpp:105:

-         xmagics()
+         m_language(GetLanguage(nullptr)), xmagics()
Suggested change
m_language = Cpp::GetLanguage(nullptr);

//NOLINTNEXTLINE (cppcoreguidelines-pro-bounds-pointer-arithmetic)
createInterpreter(Args(argv ? argv + 1 : argv, argv + argc));
m_version = get_stdopt();
m_language = Cpp::GetLanguage(nullptr);
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 member named 'GetLanguage' in namespace 'CppImpl' [clang-diagnostic-error]

	    m_language = Cpp::GetLanguage(nullptr);
                       ^

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.

1 participant