================
@@ -1104,6 +1104,19 @@ class FunctionTemplateDecl : public
RedeclarableTemplateDecl {
static FunctionTemplateDecl *CreateDeserialized(ASTContext &C,
GlobalDeclID ID);
+ SourceRange getSourceRange() const override LLVM_READONLY {
+ SourceLocation BeginLoc = getTemplateParameters()->getTemplateLoc();
+ if (BeginLoc.isInvalid() && isAbbreviated()) {
+ // The BeginLoc of FunctionTemplateDecls is derived from the template
+ // keyword. But "pure" abbreviated templates do not use the template
+ // keyword. Hence the BeginLoc is invalid. Therefore just use the
+ // beginning of the templated declaration instead.
+ BeginLoc = getTemplatedDecl()->getBeginLoc();
+ }
+
+ return SourceRange(BeginLoc, TemplatedDecl->getSourceRange().getEnd());
+ }
+
----------------
zyn0217 wrote:
Instead of having a function, I wonder if we can give the template parameter
list a valid source location, e.g. in
Sema::ActOnFinishFunctionDeclarationDeclarator?
https://github.com/llvm/llvm-project/pull/174723
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits