================
@@ -1784,3 +1784,41 @@ const Decl &clang::adjustDeclToTemplate(const Decl &D) {
// FIXME: Adjust alias templates?
return D;
}
+
+void ExplicitInstantiationDecl::anchor() {}
+
+ExplicitInstantiationDecl *ExplicitInstantiationDecl::Create(
+ ASTContext &C, DeclContext *DC, NamedDecl *Specialization,
+ SourceLocation ExternLoc, SourceLocation TemplateLoc,
+ SourceLocation TagKWLoc, NestedNameSpecifierLoc QualifierLoc,
+ const ASTTemplateArgumentListInfo *ArgsAsWritten, SourceLocation NameLoc,
+ TypeSourceInfo *TypeAsWritten, TemplateSpecializationKind TSK) {
+ return new (C, DC) ExplicitInstantiationDecl(
+ DC, Specialization, ExternLoc, TemplateLoc, TagKWLoc, QualifierLoc,
+ ArgsAsWritten, NameLoc, TypeAsWritten, TSK);
+}
+
+ExplicitInstantiationDecl *
+ExplicitInstantiationDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) {
+ return new (C, ID) ExplicitInstantiationDecl(EmptyShell());
+}
+
+SourceLocation ExplicitInstantiationDecl::getEndLoc() const {
+ // Pick the rightmost location among the name, template args, and type.
+ // For postfix types (arrays, function pointers) and function templates,
+ // the TypeLoc extends past the name. Cf. DeclaratorDecl::getSourceRange().
+ SourceLocation End = NameLoc;
+ if (TemplateArgsAsWritten && TemplateArgsAsWritten->RAngleLoc > End)
+ End = TemplateArgsAsWritten->RAngleLoc;
+ if (TypeAsWritten) {
+ SourceLocation TypeEnd = TypeAsWritten->getTypeLoc().getEndLoc();
+ if (TypeEnd.isValid() && TypeEnd > End)
+ End = TypeEnd;
+ }
----------------
16bit-ykiko wrote:
https://github.com/llvm/llvm-project/blob/078c43c582f0cd0a7c925abcd9eefdf9f63b2040/clang/lib/AST/Decl.cpp#L2103-L2112
If possible, I think we should resue logic here. But `typeIsPostfix` is a
static function. Should we extract it to the method of `QualType`?
https://github.com/llvm/llvm-project/blob/078c43c582f0cd0a7c925abcd9eefdf9f63b2040/clang/lib/AST/Decl.cpp#L2069-L2101
https://github.com/llvm/llvm-project/pull/191658
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits