void added inline comments.

================
Comment at: clang/lib/Sema/SemaChecking.cpp:16068
     DiagRuntimeBehavior(BaseExpr->getBeginLoc(), BaseExpr,
                         PDiag(DiagID) << toString(index, 10, true)
-                                      << toString(size, 10, true)
----------------
shafik wrote:
> `index` is also wrong as you can see from the diagnostic below `array index 
> 32768 is past`.
> 
> I think what you want is `index.getNumWords()` and `size.getNumWords()`.
I'm not so sure about the `index` part. The `sizeof(foo)` bit is 32768, so that 
part of the diagnostic is technically correct. (The best kind of correct! :-)

As for `getNumWords()`, won't that just default to the size of the array in 
`int`'s?


================
Comment at: clang/lib/Sema/SemaChecking.cpp:16070
-                                      << toString(size, 10, true)
+                                      << toString(ArrayTy->getSize(), 10, true)
                                       << (unsigned)size.getLimitedValue(~0U)
                                       << IndexExpr->getSourceRange());
----------------
shafik wrote:
> It is not clear what this is for.
> 
> If we look at `warn_array_index_exceeds_bounds` in `DiagnosticSemaKinds.td` 
> we can see that `element%s2` which I believe is a typo and means that this 
> argument is lost.
I think it's to (somehow) specify whether or not to add an `s` to the end of 
`element`...but I'm not 100% sure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135920

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

Reply via email to