-
Notifications
You must be signed in to change notification settings - Fork 32
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
add GetSpellingFromOperator
& GetOperatorFromSpelling
#628
Conversation
610fbe8
to
2672ab1
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
There was a problem hiding this 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!
There was a problem hiding this 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); |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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 <[email protected]>
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.
Testing
Please describe the test(s) that you added and ran to verify your changes.
Checklist