compnerd added inline comments.
================
Comment at: tools/libclang/CXType.cpp:151-153
+ if (A.getKind() != TemplateArgument::Type)
+ return MakeCXType(QualType(), TU);
+ return MakeCXType(A.getAsType(), TU);
----------------
Isn't this more compact as:
return MakeCXType(A.getKind() == TemplateArgument::Type ? A.getAsType() :
QualType(), TU);
================
Comment at: tools/libclang/CXType.cpp:961
+ return GetTemplateArgumentType(TA, i, GetTU(CT));
+ }
+ const CXXRecordDecl *RecordDecl = T->getAsCXXRecordDecl();
----------------
Why not inline the template arguments?
================
Comment at: tools/libclang/CXType.cpp:965
return MakeCXType(QualType(), GetTU(CT));
- const TemplateArgument &A = TA[i];
- if (A.getKind() != TemplateArgument::Type)
+ const ClassTemplateSpecializationDecl *TemplateDecl =
+ dyn_cast<ClassTemplateSpecializationDecl>(RecordDecl);
----------------
Use `auto`, the type is obvious.
================
Comment at: tools/libclang/CXType.cpp:970
+ const TemplateArgumentList &TA = TemplateDecl->getTemplateArgs();
+ return GetTemplateArgumentType(TA, i, GetTU(CT));
}
----------------
Similar.
https://reviews.llvm.org/D27384
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits