ChuanqiXu created this revision. ChuanqiXu added reviewers: erichkeane, aaron.ballman, cor3ntin. ChuanqiXu added a project: clang. Herald added a subscriber: kristof.beyls. Herald added a project: All. ChuanqiXu requested review of this revision. Herald added a subscriber: cfe-commits.
I found this when reading the codes. I think it makes sense to reduce the space for TemplateParmPosition. It is hard to image the depth of template parameter is larger than 2^20 and the index is larger than 2^12. So I think the patch might be reasonable. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D123298 Files: clang/include/clang/AST/DeclTemplate.h Index: clang/include/clang/AST/DeclTemplate.h =================================================================== --- clang/include/clang/AST/DeclTemplate.h +++ clang/include/clang/AST/DeclTemplate.h @@ -1148,10 +1148,8 @@ /// parameters and is not part of the Decl hierarchy. Just a facility. class TemplateParmPosition { protected: - // FIXME: These probably don't need to be ints. int:5 for depth, int:8 for - // position? Maybe? - unsigned Depth; - unsigned Position; + unsigned Depth : 20; + unsigned Position : 12; TemplateParmPosition(unsigned D, unsigned P) : Depth(D), Position(P) {}
Index: clang/include/clang/AST/DeclTemplate.h =================================================================== --- clang/include/clang/AST/DeclTemplate.h +++ clang/include/clang/AST/DeclTemplate.h @@ -1148,10 +1148,8 @@ /// parameters and is not part of the Decl hierarchy. Just a facility. class TemplateParmPosition { protected: - // FIXME: These probably don't need to be ints. int:5 for depth, int:8 for - // position? Maybe? - unsigned Depth; - unsigned Position; + unsigned Depth : 20; + unsigned Position : 12; TemplateParmPosition(unsigned D, unsigned P) : Depth(D), Position(P) {}
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits