Skip to content

Helper for FunctionTemplateDecl -> FunctionDecl - #1104

Merged
Vipul-Cariappa merged 1 commit into
compiler-research:mainfrom
keremsahn:ftd-helper
Oct 9, 2026
Merged

Vipul-Cariappa merged 1 commit into
compiler-research:mainfrom
keremsahn:ftd-helper

Conversation

@keremsahn

Copy link
Copy Markdown
Contributor
D = UnwrapUsingShadowToFunction(D);
if (const auto* FTD = dyn_cast_or_null<FunctionTemplateDecl>(D))
    D = FTD->getTemplatedDecl();
return dyn_cast_or_null<FunctionDecl>(D);

I used this pattern at least four times and going to use again, so a helper removes repeating code

@Vipul-Cariappa

@github-actions github-actions Bot left a comment

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.

clang-tidy made some suggestions


// Resolves the FunctionDecl a decl names, looking through a using-shadow and
// a template pattern. Null when the decl does not name a function.
static const clang::FunctionDecl* UnwrapToFunctionDecl(const clang::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: unused function 'UnwrapToFunctionDecl' [clang-diagnostic-unused-function]

function.
                                            ^

@Vipul-Cariappa Vipul-Cariappa left a comment

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.

This is fine, I guess. But could you also add its usages in the existing code?

…nce this pattern written at least four times by me, to not repeat code I wrote this helper
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.52%. Comparing base (f34af30) to head (1732daf).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1104      +/-   ##
==========================================
- Coverage   88.53%   88.52%   -0.02%     
==========================================
  Files          24       24              
  Lines        6858     6851       -7     
==========================================
- Hits         6072     6065       -7     
  Misses        786      786              
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 91.11% <100.00%> (-0.02%) ⬇️
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 91.11% <100.00%> (-0.02%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Vipul-Cariappa
Vipul-Cariappa merged commit 2332f84 into compiler-research:main Oct 9, 2026
32 checks passed
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