Skip to content

Teach GetType and friends about typedef names.#885

Merged
vgvassilev merged 1 commit intocompiler-research:mainfrom
vgvassilev:typedefs-in-GetType
Apr 2, 2026
Merged

Teach GetType and friends about typedef names.#885
vgvassilev merged 1 commit intocompiler-research:mainfrom
vgvassilev:typedefs-in-GetType

Conversation

@vgvassilev
Copy link
Copy Markdown
Contributor

No description provided.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.86%. Comparing base (039bf04) to head (4596cc3).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/CppInterOp/CppInterOp.cpp 93.33% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #885      +/-   ##
==========================================
- Coverage   78.86%   78.86%   -0.01%     
==========================================
  Files          11       11              
  Lines        4079     4083       +4     
==========================================
+ Hits         3217     3220       +3     
- Misses        862      863       +1     
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 87.42% <93.33%> (-0.03%) ⬇️
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 87.42% <93.33%> (-0.03%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vgvassilev vgvassilev force-pushed the typedefs-in-GetType branch from 041b5d2 to 4596cc3 Compare April 2, 2026 13:51
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

*/
return QualType();
}
static std::optional<QualType> GetTypeInternal(Decl* D) {
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: 'GetTypeInternal' is a static definition in anonymous namespace; static is redundant here [readability-static-definition-in-anonymous-namespace]

Suggested change
static std::optional<QualType> GetTypeInternal(Decl* D) {
std::optional<QualType> GetTypeInternal(Decl* D) {

*/
return QualType();
}
static std::optional<QualType> GetTypeInternal(Decl* D) {
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: no header providing "std::optional" is directly included [misc-include-cleaner]

lib/CppInterOp/CppInterOp.cpp:52:

- #if CLANG_VERSION_MAJOR >= 20
+ #include <optional>
+ #if CLANG_VERSION_MAJOR >= 20

}

return (TCppType_t)0;
return GetTypeFromScope((Decl*)GetNamed(name, /*Within=*/nullptr));
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: argument name 'Within' in comment does not match parameter name 'parent' [bugprone-argument-comment]

  return GetTypeFromScope((Decl*)GetNamed(name, /*Within=*/nullptr));
                                                ^
Additional context

include/CppInterOp/CppInterOp.h:489: 'parent' declared here

                                    TCppScope_t parent = nullptr);
                                                ^

lib/CppInterOp/CppInterOp.cpp:779: actual callee ('GetNamed') is declared here

TCppScope_t GetNamed(const std::string& name,
            ^

}

return (TCppType_t)0;
return GetTypeFromScope((Decl*)GetNamed(name, /*Within=*/nullptr));
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]

  return GetTypeFromScope((Decl*)GetNamed(name, /*Within=*/nullptr));
                          ^


if (auto* TD = dyn_cast<TypeDecl>(D))
return getASTContext().getTypeDeclType(TD).getAsOpaquePtr();
if (auto QT = GetTypeInternal((Decl*)klass))
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]

  if (auto QT = GetTypeInternal((Decl*)klass))
                                ^


std::vector<Decl*> Decls;
GetAllTopLevelDecls(code, Decls);
auto Ty = Cpp::GetType("Type_t");
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: 'auto Ty' can be declared as 'auto *Ty' [llvm-qualified-auto]

Suggested change
auto Ty = Cpp::GetType("Type_t");
auto *Ty = Cpp::GetType("Type_t");

Copy link
Copy Markdown
Collaborator

@aaronj0 aaronj0 left a comment

Choose a reason for hiding this comment

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

LGTM! I would rerun after rebasing on #884, which should then run numba and leakcheck tests

@vgvassilev vgvassilev merged commit 55d9654 into compiler-research:main Apr 2, 2026
33 checks passed
@vgvassilev vgvassilev deleted the typedefs-in-GetType branch April 2, 2026 15:53
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