[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)
    Younan Zhang via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Sep 10 08:04:50 PDT 2024
    
    
  
================
@@ -15257,6 +15264,13 @@ Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D,
 
   D.setFunctionDefinitionKind(FunctionDefinitionKind::Definition);
   Decl *DP = HandleDeclarator(ParentScope, D, TemplateParameterLists);
+  if (auto *D = DP) {
+    if (auto *TD = dyn_cast<FunctionTemplateDecl>(D))
+      D = TD->getTemplatedDecl();
+    else
+      assert(isa<FunctionDecl>(D));
----------------
zyn0217 wrote:
Maybe
```cpp
assert((isa<FunctionDecl, FunctionTemplateDecl>(D)));
if (auto *FTD = dyn_cast<>)
  ...
```
?
https://github.com/llvm/llvm-project/pull/107942
    
    
More information about the llvm-commits
mailing list