================
@@ -1374,6 +1379,18 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator 
&D,
                                                   : MultiTemplateParamsArg(),
                                               &SkipBody, BodyKind);
 
+  auto updateFuncRangeEnd = [&](Decl *D) {
+    if (!FuncRangeEnd.isValid() || !D)
+      return;
+    if (auto *FD = dyn_cast<FunctionDecl>(D)) {
+      FD->setRangeEnd(FuncRangeEnd);
+    } else if (auto *FT = dyn_cast<FunctionTemplateDecl>(D)) {
+      if (auto *InnerFD = FT->getTemplatedDecl())
----------------
zwuis wrote:

`getTemplatedDecl` should never return `nullptr`. Use `assert` instead if you 
still want to check the return value.

https://github.com/llvm/llvm-project/pull/167007
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to