aaron.ballman added a comment.

In D119525#3313554 <https://reviews.llvm.org/D119525#3313554>, @tbaeder wrote:

> This is a pretty big gotcha at best and I feel like `getArraySize()` should 
> return `None` in that case instead... thoughts?

I think it is a gotcha -- some places protect against a null pointer 
(https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/TreeTransform.h#L11923
 and 
https://github.com/llvm/llvm-project/blob/main/clang/lib/AST/StmtPrinter.cpp#L2138)
 while other places assume the pointer isn't null 
(https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGExprCXX.cpp#L731
 and 
https://github.com/llvm/llvm-project/blob/main/clang/lib/AST/ExprConstant.cpp#L9431).
 So I think a better approach is to fix up the interface so it doesn't return 
nullptr rather than play whack-a-mole forever with the API (and fix up the 
places currently checking for nullptr explicitly).


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

https://reviews.llvm.org/D119525

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

Reply via email to