ChuanqiXu added a comment.

> On the other hand, why not use 16 for both?
I am consistent with @aaron.ballman here.



================
Comment at: clang/include/clang/AST/DeclTemplate.h:1156-1157
 
-  TemplateParmPosition(unsigned D, unsigned P) : Depth(D), Position(P) {}
+  static constexpr unsigned MaxDepth = (1l << DEPTH_BITWIDTH) - 1;
+  static constexpr unsigned MaxPosition = (1l << POSITION_BITWIDTH) - 1;
+
----------------
I don't find standard way to generate the maximum value for bit fields.. So I 
choose to calculate it by hand. 


================
Comment at: clang/include/clang/AST/DeclTemplate.h:1163-1164
+  TemplateParmPosition(unsigned D, unsigned P) : Depth(D), Position(P) {
+    // The input may fill maximum values to show that it is invalid.
+    // Add one here to convert it to zero.
+    assert((D + 1) <= MaxDepth &&
----------------
I find it is possible if ast-dump is going to dump from JSON files.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123298/new/

https://reviews.llvm.org/D123298

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to