Skip to content

add GetSpellingFromOperator & GetOperatorFromSpelling #628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2025

Conversation

Vipul-Cariappa
Copy link
Collaborator

Description

Please include a summary of changes, motivation and context for this PR.

Fixes # (issue)

Type of change

Please tick all options which are relevant.

  • Bug fix
  • New feature
  • Requires documentation updates

Testing

Please describe the test(s) that you added and ran to verify your changes.

Checklist

  • I have read the contribution guide recently

Copy link

codecov bot commented Jun 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.77%. Comparing base (360a117) to head (1d2601e).
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #628      +/-   ##
==========================================
+ Coverage   77.70%   77.77%   +0.07%     
==========================================
  Files           9        9              
  Lines        3749     3761      +12     
==========================================
+ Hits         2913     2925      +12     
  Misses        836      836              
Files with missing lines Coverage Δ
include/CppInterOp/CppInterOp.h 100.00% <ø> (ø)
lib/CppInterOp/CppInterOp.cpp 85.22% <100.00%> (+0.08%) ⬆️
Files with missing lines Coverage Δ
include/CppInterOp/CppInterOp.h 100.00% <ø> (ø)
lib/CppInterOp/CppInterOp.cpp 85.22% <100.00%> (+0.08%) ⬆️
🚀 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.

Awesome. Let's update the clients, too!

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

@@ -3559,6 +3560,19 @@ std::string GetFunctionArgName(TCppFunction_t func, TCppIndex_t param_index) {
return PI->getNameAsString();
}

std::string GetSpellingFromOperator(Operator Operator) {
return clang::getOperatorSpelling((clang::OverloadedOperatorKind)Operator);
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 use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

  auto* D = (clang::Decl*)func;
            ^

if ((Spelling) == op) { \
return (Operator)OO_##Name; \
}
#include "clang/Basic/OperatorKinds.def"
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage]

  return PI->getNameAsString();
         ^
Additional context

lib/CppInterOp/CppInterOp.cpp:3564: 'PI' initialized to a null pointer value

  clang::ParmVarDecl* PI = nullptr;
  ^

lib/CppInterOp/CppInterOp.cpp:3566: Assuming null pointer is passed into cast

  if (auto* FD = llvm::dyn_cast_or_null<clang::FunctionDecl>(D))
                 ^

lib/CppInterOp/CppInterOp.cpp:3566: 'FD' is null

  if (auto* FD = llvm::dyn_cast_or_null<clang::FunctionDecl>(D))
            ^

lib/CppInterOp/CppInterOp.cpp:3566: Taking false branch

  if (auto* FD = llvm::dyn_cast_or_null<clang::FunctionDecl>(D))
  ^

lib/CppInterOp/CppInterOp.cpp:3568: Assuming null pointer is passed into cast

  else if (auto* FD = llvm::dyn_cast_or_null<clang::FunctionTemplateDecl>(D))
                      ^

lib/CppInterOp/CppInterOp.cpp:3568: 'FD' is null

  else if (auto* FD = llvm::dyn_cast_or_null<clang::FunctionTemplateDecl>(D))
                 ^

lib/CppInterOp/CppInterOp.cpp:3568: Taking false branch

  else if (auto* FD = llvm::dyn_cast_or_null<clang::FunctionTemplateDecl>(D))
       ^

lib/CppInterOp/CppInterOp.cpp:3571: Called C++ object pointer is null

  return PI->getNameAsString();
         ^

@Vipul-Cariappa Vipul-Cariappa merged commit 40ecc1d into compiler-research:main Jun 12, 2025
50 checks passed
@Vipul-Cariappa Vipul-Cariappa deleted the dev/op-string branch June 12, 2025 14:25
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.

3 participants