[RFC][NFCI][Constants] Add `Constant::isZeroValue`
The old `isZeroValue` was removed because it was functionally identical to
`Constant::isNullValue`. Currently, a "null value" in LLVM means a zero value.
We are moving toward changing the semantics of `ConstantPointerNull` to
represent a semantic null pointer instead of a zero-valued pointer. As a result,
the meaning of "null value" will also change in the future.
This PR series is the first step toward renaming the two widely used "null
value" interfaces to "zero value". As the first PR in the series, this change
adds a "new" `isZeroValue` alongside `isNullValue`, and makes `isNullValue` call
`isZeroValue` directly. Then, all uses of `isNullValue` in LLVM are replaced
with `isZeroValue`. Uses in other projects will be updated in separate PRs.
The plan is to eventually remove `isNullValue` after all uses have been
migrated.
[lldb] IRForTarget::UnfoldConstant should return an llvm::Error (#195322)
UnfoldConstant returns a boolean and logs errors to a stream. However,
the prevailing pattern is to return an Error object and let the caller
decide what to do with it.
Currently, these error messages are dumped out to stdout when LLDB
encoutners an issue. I decided not to change that behavior with this
commit to keep it simple and self-contained.
I also reformatted and simplified some code in UnfoldConstant where it
was relatively easy.
[docs] Document the usage of operators on RVV sized types (#194979)
We have existing support in clang for operator overloading on RVV
builtin types when those types are sized. This can be achieved through a
combination of the -mrvv-vector-bits=N command line (to communicate
exact VLEN to the compiler) and the riscv_rvv_vector_bits attribute on
the types themselves. We have fairly complete test coverage for this in
clang/test/CodeGen/RISCV/rvv-vls-*.ll.
Our documentation did not reflect this reality, so this patch updates
the documentation to match the actual support.
Patch written by Claude, with minor sanity checking by me.
[RFC][NFCI][Constants] Add `Constant::isZeroValue`
The old `isZeroValue` was removed because it was functionally identical to
`Constant::isNullValue`. Currently, a "null value" in LLVM means a zero value.
We are moving toward changing the semantics of `ConstantPointerNull` to
represent a semantic null pointer instead of a zero-valued pointer. As a result,
the meaning of "null value" will also change in the future.
This PR series is the first step toward renaming the two widely used "null
value" interfaces to "zero value". As the first PR in the series, this change
adds a "new" `isZeroValue` alongside `isNullValue`, and makes `isNullValue` call
`isZeroValue` directly. Then, all uses of `isNullValue` in LLVM are replaced
with `isZeroValue`. Uses in other projects will be updated in separate PRs.
The plan is to eventually remove `isNullValue` after all uses have been
migrated.
[Codegen] Initialize RValue IsVolatile field in constructor (#195556)
Static analysis flagged that in some cases IsVolatile is left
uninitialzed. I adjusted the constructor to initialize IsVolatile.
[clang] Add formal linkage to textual AST dump (#194600)
This PR adds formal linkage (external, module, internal) to the textual
AST dumps. The motivation is to inform users (including ourselves) what
Clang thinks the linkage is, and to prevent situations where `extern` is
mistaken for an indication of external linkage (see #192116 for an
example).
The wording around linkage is known to be defective, but that's the best
we have: [[basic.link]](https://eel.is/c++draft/basic.link) paragraphs 3
through 7.
There are enough changes in this PR, so I decided to defer adding formal
linkage to JSON dumps to another PR.
(Open questions and suggestions for reviewers are in
https://github.com/llvm/llvm-project/pull/194600#issuecomment-4360515791)
---------
Co-authored-by: Matheus Izvekov <mizvekov at gmail.com>