Add new llvm.dbg.declare_value intrinsic. (#168132)
For swift async code, we need to use a debug intrinsic that behaves like
an llvm.dbg.declare but can take any location type rather than just a
pointer or integer.
To solve this, a new debug instrinsic called llvm.dbg.declare_value has
been created, which behaves exactly like an llvm.dbg.declare but can
take non pointer and integer location types.
More information here:
https://discourse.llvm.org/t/rfc-introduce-new-llvm-dbg-coroframe-entry-intrinsic/88269
This is the first patch as part of a stack of patches, with the one
succeeding it being: https://github.com/llvm/llvm-project/pull/168134
ADT: Complete the at() methods for DenseMap and MapVector
Make it easier to use these containers as drop-in replacements for
std::map.
commit-id:8b1d1826
[libc++][any][NFC] Reformat and refactor any_cast tests (#169057)
...in preparation for https://github.com/llvm/llvm-project/pull/168826
as requested in the review.
Co-authored-by: Hristo Hristov <zingam at outlook.com>
[lldb] Remove redundant declarations (NFC) (#169003)
In C++17, static constexpr members are implicitly inline, so they no
longer require an out-of-line definition.
Identified with readability-redundant-declaration.
[NFC][LLDB] Make it possible to detect if the compiler used in tests supports -fbounds-safety (#169112)
This patch makes it possible to detect in LLDB shell and API tests if
`-fbounds-safety` is supported by the compiler used for testing. The
motivation behind this is to allow upstreaming
https://github.com/swiftlang/llvm-project/pull/11835 but with the tests
disabled in upstream because the full implementation of -fbounds-safety
isn't available in Clang yet.
For shell tests when -fbounds-safety is available the
`clang-bounds-safety` feature is available which means tests can be
annotated with `# REQUIRES: clang-bounds-safety`.
API tests that need -fbounds-safety support in the compiler can use the
new `@skipUnlessBoundsSafety` decorator.
rdar://165225507
[lld:MachO] Allow independent override of weak symbols aliased via .set (#167825)
Currently, if multiple external weak symbols are defined at the same
address in an object file (e.g., by using the .set assembler directive
to alias them to a single weak variable), ld64.lld treats them as a
single unit. When any one of these symbols is overridden by a strong
definition, all of the original weak symbols resolve to the strong
definition.
This patch changes the behavior in `transplantSymbolsAtOffset`. When a
weak symbol is being replaced by a strong one, only non-external (local)
symbols at the same offset are moved to the new symbol's section. Other
*external* symbols are no longer transplanted.
This allows each external weak symbol to be overridden independently.
This behavior is consistent with Apple's ld-classic, but diverges from
ld-prime in one case, as noted on
https://github.com/llvm/llvm-project/issues/167262 (this discrepancy has
recently been reported to Apple).
[18 lines not shown]
[CI] Make Premerge only Comment if Tests Failed (#169102)
Before, we were unconditionally writing a message. After this patch, we
only write a message when the tests failed, or there is already an
existing comment. This is how this workflow was intended to work
originally, but is not how it ended up working, mostly due to my
misconceptions around how the existing code formatter pass handled this
case (we need to actually not write out any comments, not write out a
specific message).
[CIR] Implement global array dtor support (#169070)
This implements handling to destroy global arrays that require
destruction. Unlike classic codegen, CIR emits the destructor loop into
a 'dtor' region associated with the global array variable. Later, during
LoweringPrepare, this code is moved into a helper function and a call to
__cxa_atexit arranges for it to be called during the shared object
shutdown.
[lldb] Fix EditlineTest closing files multiple times. (#169100)
This updates the EditlineTest to use `lldb::FileSP` to ensure the
associated FDs are only closed a single time.
Currently, there is some confusion between the `FilePointer`,
`PseudoTerminal` and `LockableStreamFile` about when the files are
closed resulting in a crash in some due to a `fflush` on a closed file.
[ORC] Fix obj-imageinfo.S on X86 Darwin with Internal Shell (#169104)
d464c99f595b69d3a34b361b6a935e803c60d308 fixes this test on AArch64
Darwin, but I did not realize that there was another X86 version of the
test. This patch also updates the X86 version of the test in a similar
manner.
[include-cleaner] Use lit internal shell by default for tests (#169092)
All of the tests seem to be compatible with the internal shell and the
internal shell is typically faster by 10-15% on top of providing a
better debugging experience.
[test][Support] Disable SignalsTest.PrintsSymbolizerMarkup (#168974)
This test checks that DSOMarkupPrinter::printDSOMarkup prints the module
and segment mappings, but that is only done if we can determine the GNU
build ID for the given object, and in many environments that is not
enabled by default (e.g. the FreeBSD Clang driver never enables it, and
various other Clang drivers only do so when ENABLE_LINKER_BUILD_ID is
opted into at configure time). GCC tends to enable it by default, and
many distributions enable it for Clang, so this has gone unnoticed for a
while, but this test has been failing on FreeBSD since its creation.
Fixes: 22b9404f09dc ("Optionally print symbolizer markup backtraces.")
See: https://github.com/llvm/llvm-project/issues/168891
[llvm] Replace `OwningArrayRef` with `std::vector` in `BTFParser`
`OwningArrayRef` requires that the size and the capacity are the same. This prevents reusing memory allocations unless the size happens to be exactly the same (which is rare enough we don't even try). Switch to `std::vector` instead so that we're not repeatedly calling `new[]` and `delete[]`.
[llvm][clang] Remove `llvm::OwningArrayRef`
`OwningArrayRef` has several problems.
The naming is strange: `ArrayRef` is specifically a non-owning view, so the name means "owning non-owning view".
It has a const-correctness bug that is inherent to the interface. `OwningArrayRef<T>` publicly derives from `MutableArrayRef<T>`. This means that the following code compiles:
```c++
void const_incorrect(llvm::OwningArrayRef<int> const a) {
a[0] = 5;
}
```
It's surprising for a non-reference type to allow modification of its elements even when it's declared `const`. However, the problems from this inheritance (which ultimately stem from the same issue as the weird name) are even worse. The following function compiles without warning but corrupts memory when called:
```c++
void memory_corruption(llvm::OwningArrayRef<int> a) {
a.consume_front();
[17 lines not shown]
Really fix tysan test failing on unsupported arches (#169096)
'target' is not one of the features recognized by clang tests, and the
test doesn't require X86 backend to be built. Specify the target
explicitly instead. Remove duplicate `-fsanitize=type` as well.