File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -503,6 +503,10 @@ class Converter : public clang::RecursiveASTVisitor<Converter> {
503503 return true ;
504504 }
505505
506+ bool TraverseExplicitInstantiationDecl (clang::ExplicitInstantiationDecl *) {
507+ return true ;
508+ }
509+
506510 virtual bool
507511 VisitCXXStdInitializerListExpr (clang::CXXStdInitializerListExpr *expr);
508512
Original file line number Diff line number Diff line change @@ -265,7 +265,14 @@ bool IsCodeUnitStringLiteral(const clang::StringLiteral *expr) {
265265bool IsUserDefinedDecl (const clang::Decl *decl) {
266266 const auto &ctx = decl->getASTContext ();
267267 const auto &src_mgr = ctx.getSourceManager ();
268- const auto src_loc = decl->getLocation ();
268+ auto src_loc = decl->getLocation ();
269+ if (auto *spec = clang::dyn_cast<clang::ClassTemplateSpecializationDecl>(decl);
270+ spec && (spec->getSpecializationKind () ==
271+ clang::TSK_ExplicitInstantiationDeclaration ||
272+ spec->getSpecializationKind () ==
273+ clang::TSK_ExplicitInstantiationDefinition)) {
274+ src_loc = spec->getSpecializedTemplate ()->getLocation ();
275+ }
269276 return !decl->getBeginLoc ().isInvalid () && !decl->isImplicit () &&
270277 !src_mgr.isInSystemHeader (src_loc) &&
271278 !src_mgr.isInSystemMacro (src_loc);
Original file line number Diff line number Diff line change @@ -39,7 +39,20 @@ template <typename T> struct Outer {
3939 Inner<int > with (int n) const { return Inner<int >{v, n}; }
4040};
4141
42+ struct Elem {
43+ int i;
44+ };
45+
46+ template class std ::vector<Elem>;
47+
48+ template struct Boxed <short >;
49+
4250int main () {
51+ std::vector<Elem> ev;
52+ ev.push_back (Elem{2 });
53+ assert (ev[0 ].i == 2 );
54+ assert (Boxed<short >::twice (2 ) == 4 );
55+
4356 Outer<int > oi{3 };
4457 assert (oi.with (4 ).sum () == 7 );
4558 Outer<long > ol{5 };
You can’t perform that action at this time.
0 commit comments