sammccall added a comment.

Ooh, this is messy indeed. Thanks for digging!



================
Comment at: clang-tools-extra/clangd/Selection.cpp:526
+  // the traversal order of SizeExpr and ElementTypeLoc, which gives a chance
+  // for the SizeExpr to claim its tokens.
+  bool TraverseConstantArrayTypeLoc(ConstantArrayTypeLoc X) {
----------------
I don't think this is a complete solution: won't the inner ArrayTypeLoc still 
end up owning both sets of brackets?

I think maybe a better solution is making getSourceRange(ArrayTypeLoc) return 
only ATL.getBracketRange(), and then modify canSafelySkipNode to to avoid 
pruning based on this small range.

This is vaguely similar to how DeclTypeLoc works today (though in that case the 
reduced range is the one reported by the AST).


================
Comment at: clang-tools-extra/clangd/Selection.cpp:527
+  // for the SizeExpr to claim its tokens.
+  bool TraverseConstantArrayTypeLoc(ConstantArrayTypeLoc X) {
+    if (!Base::TraverseStmt(X.getSizeExpr()))
----------------
ConstantArrayType isn't the only kind of array, see the other subclasses of 
ArrayType


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116218

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

Reply via email to