Skip to content

Update GetFunctionArgName API for template functions #224

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
Apr 10, 2024

Conversation

aaronj0
Copy link
Collaborator

@aaronj0 aaronj0 commented Apr 9, 2024

No description provided.

@@ -829,6 +838,19 @@ TEST(FunctionReflectionTest, GetFunctionArgName) {
EXPECT_EQ(Cpp::GetFunctionArgName(Decls[1], 1), "d");
EXPECT_EQ(Cpp::GetFunctionArgName(Decls[1], 2), "l");
EXPECT_EQ(Cpp::GetFunctionArgName(Decls[1], 3), "ch");

// EXPECT_EQ(Cpp::GetFunctionArgName(Decls[2], 0), "");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove the commented code or I comment it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

these tests pass, have uncommented

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

@@ -3047,8 +3047,12 @@ namespace Cpp {
std::string GetFunctionArgName(TCppFunction_t func, TCppIndex_t param_index)
{
auto *D = (clang::Decl *)func;
auto *FD = llvm::cast<clang::FunctionDecl>(D);
auto PI = FD->getParamDecl(param_index);
clang::ParmVarDecl* PI;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'PI' is not initialized [cppcoreguidelines-init-variables]

Suggested change
clang::ParmVarDecl* PI;
clang::ParmVarDecl* PI = nullptr;

@vgvassilev vgvassilev merged commit ffeec07 into compiler-research:main Apr 10, 2024
41 of 42 checks passed
@aaronj0 aaronj0 deleted the update-functionargname branch April 22, 2024 12:44
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