Skip to content

add GetSpellingFromOperator & GetOperatorFromSpelling#628

Merged
Vipul-Cariappa merged 2 commits intocompiler-research:mainfrom
Vipul-Cariappa:dev/op-string
Jun 12, 2025
Merged

add GetSpellingFromOperator & GetOperatorFromSpelling#628
Vipul-Cariappa merged 2 commits intocompiler-research:mainfrom
Vipul-Cariappa:dev/op-string

Conversation

@Vipul-Cariappa
Copy link
Copy Markdown
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

@codecov
Copy link
Copy Markdown

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 66 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
Copy Markdown
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
Copy Markdown
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

}

std::string GetSpellingFromOperator(Operator Operator) {
return clang::getOperatorSpelling((clang::OverloadedOperatorKind)Operator);
Copy link
Copy Markdown
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
Copy Markdown
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();
         ^

Co-authored-by: mcbarton <matthew.c.barton@hotmail.co.uk>
@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