Merge GetCompleteName and GetQualifiedCompleteName into shared helper#846
Merged
Vipul-Cariappa merged 1 commit intocompiler-research:mainfrom Mar 12, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
Collaborator
Vipul-Cariappa
left a comment
There was a problem hiding this comment.
Looks good to me!
One minor comment:
lib/CppInterOp/CppInterOp.cpp
Outdated
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; | ||
| } |
Collaborator
There was a problem hiding this comment.
Policy is only used inside the NamedDecl if block. Therefore, we can move this inside.
Contributor
Author
There was a problem hiding this comment.
Policyis only used inside theNamedDeclif block. Therefore, we can move this inside.
Made this change and pushed!
434c1b2 to
f6ad729
Compare
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
Vipul-Cariappa
approved these changes
Mar 12, 2026
Collaborator
Vipul-Cariappa
left a comment
There was a problem hiding this comment.
LGTM! Provided the tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Refactor
GetCompleteNameandGetQualifiedCompleteNameinto a shared static helperGetCompleteNameImplto eliminate code duplication.The two functions had kind of identical logic.
The only differences were a few
PrintingPolicyflags 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 theFunctionDeclwhich it was missing.Resolves the FIXME at line 645:
// FIXME: Figure out how to merge with GetCompleteName.Type of change
Testing
ScopeReflection_GetCompleteName— PASSEDScopeReflection_GetQualifiedCompleteName— PASSEDScopeReflection_Demangle(also exercisesGetQualifiedCompleteName) — PASSEDChecklist