Skip to content

Merge GetCompleteName and GetQualifiedCompleteName into shared helper#846

Merged
Vipul-Cariappa merged 1 commit intocompiler-research:mainfrom
tryh4rd-26:merge-get-complete-name
Mar 12, 2026
Merged

Merge GetCompleteName and GetQualifiedCompleteName into shared helper#846
Vipul-Cariappa merged 1 commit intocompiler-research:mainfrom
tryh4rd-26:merge-get-complete-name

Conversation

@tryh4rd-26
Copy link
Copy Markdown
Contributor

Description

Refactor GetCompleteName and GetQualifiedCompleteName into a shared static helper GetCompleteNameImpl to eliminate code duplication.

The two functions had kind of identical logic.

The only differences were a few PrintingPolicy flags and whether to use the qualified names. I made this change to unify both of them into a common param thats boolean (qualified)

While this wasnt mentioned in the fix me as bonus, I tried to implement GetQualifiedCompleteNamein away that it also handles the FunctionDecl which it was missing.

Resolves the FIXME at line 645:
// FIXME: Figure out how to merge with GetCompleteName.

Type of change

  • Bug fix
  • New feature
  • Requires documentation updates

Testing

  • ScopeReflection_GetCompleteName — PASSED
  • ScopeReflection_GetQualifiedCompleteName — PASSED
  • ScopeReflection_Demangle (also exercises GetQualifiedCompleteName) — PASSED
  • Full test suite: 100% tests passed, 0 failed out of 3 (307 tests total)

Checklist

  • I have read the contribution guide recently

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.72%. Comparing base (a0d70b5) to head (f6ad729).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #846      +/-   ##
==========================================
- Coverage   79.75%   79.72%   -0.03%     
==========================================
  Files          11       11              
  Lines        4035     4025      -10     
==========================================
- Hits         3218     3209       -9     
+ Misses        817      816       -1     
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 87.95% <100.00%> (-0.01%) ⬇️
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 87.95% <100.00%> (-0.01%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Copy Markdown
Collaborator

@Vipul-Cariappa Vipul-Cariappa left a comment

Choose a reason for hiding this comment

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

Looks good to me!
One minor comment:

Comment on lines +599 to +610
PrintingPolicy Policy = C.getPrintingPolicy();
Policy.SuppressUnwrittenScope = true;
Policy.SuppressScope = true;
Policy.AnonymousTagLocations = false;
Policy.SuppressTemplateArgsInCXXConstructors = false;
Policy.SuppressDefaultTemplateArgs = false;
Policy.AlwaysIncludeTypeForTemplateArgument = true;
if (qualified) {
Policy.FullyQualifiedName = true;
Policy.SuppressElaboration = true;
} else {
Policy.SuppressScope = true;
Policy.AnonymousTagLocations = false;
Policy.SuppressTemplateArgsInCXXConstructors = false;
Policy.SuppressDefaultTemplateArgs = false;
Policy.AlwaysIncludeTypeForTemplateArgument = true;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Policy is only used inside the NamedDecl if block. Therefore, we can move this inside.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Policy is only used inside the NamedDecl if block. Therefore, we can move this inside.

Made this change and pushed!

@tryh4rd-26 tryh4rd-26 force-pushed the merge-get-complete-name branch from 434c1b2 to f6ad729 Compare March 12, 2026 12:38
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Copy Markdown
Collaborator

@Vipul-Cariappa Vipul-Cariappa left a comment

Choose a reason for hiding this comment

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

LGTM! Provided the tests pass.

@Vipul-Cariappa Vipul-Cariappa merged commit 4e3e4c2 into compiler-research:main Mar 12, 2026
36 checks passed
@tryh4rd-26 tryh4rd-26 deleted the merge-get-complete-name branch March 14, 2026 13:16
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