SuccessChanges

Summary

  1. [libunwind] Combine dl_iterate_phdr codepaths for DWARF and EHABI (details)
  2. [libunwind] Optimize dl_iterate_phdr's findUnwindSectionsByPhdr (details)
  3. [JSON] Add error reporting to fromJSON and ObjectMapper (details)
  4. Fix LLDB tweak in 62a47e994fcf5b73e29547d26cd9676b30cb69a3 (details)
  5. [libc++] Fix spurious test failure in -fno-exceptions (details)
  6. [clangd] Improve bad-RPC-payload error messages slightly (details)
  7. [CGProfile] don't emit cgprofile entry if called function is dllimport (details)
  8. Explicitly specify CMAKE_AR in WinMsvc.cmake (details)
Commit b16d6653c01cee37f51a98dd4092c4ef302c47a5 by rprichard
[libunwind] Combine dl_iterate_phdr codepaths for DWARF and EHABI

dl_iterate_phdr is used to search for unwind info provided by either
PT_GNU_EH_FRAME or PT_ARM_EXIDX. Most of the code between the two is
the same, so combine them, and factor out what's different into
checkForUnwindInfoSegment.

Details:
- The FrameHeaderCache can now be enabled for ARM EHABI.
- findUnwindSectionsByPhdr now finds the last PT_ARM_EXIDX rather than
   the first. There should only be one segment.
- The dso_base and text_segment_length fields of UnwindInfoSections
   are now needed for dl_iterate_phdr when using EHABI, to hold the
   low and high PC values for a cache entry.

Reviewed By: compnerd, danielkiss, #libunwind, saugustine

Differential Revision: https://reviews.llvm.org/D87880
The file was modifiedlibunwind/test/frameheadercache_test.pass.cpp
The file was modifiedlibunwind/src/AddressSpace.hpp
Commit 881aba7071c6e4cc2417e875ca5027ec7c0a92a3 by rprichard
[libunwind] Optimize dl_iterate_phdr's findUnwindSectionsByPhdr

Currently, findUnwindSectionsByPhdr is slightly micro-optimized for the
case where the first callback has the target address, and is otherwise
very inefficient -- it decodes .eh_frame_hdr even when no PT_LOAD
matches the PC. (If the FrameHeaderCache is enabled, then the
micro-optimization only helps the first time unwind info is looked up.)

Instead, it makes more sense to optimize for the case where the
callback *doesn't* find the target address, so search for a PT_LOAD
segment first, and only look for the unwind info section if a matching
PT_LOAD is found.

This change helps on an Android benchmark with 100 shared objects,
where the DSO at the end of the dl_iterate_phdr list throws 10000
exceptions. Assuming the frame cache is disabled, this change cuts
about 30-40% off the benchmark's runtime.

Reviewed By: compnerd, saugustine, #libunwind

Differential Revision: https://reviews.llvm.org/D87881
The file was modifiedlibunwind/src/AddressSpace.hpp
Commit fa69b608063eecba76fb35d167b063cbfe532c28 by sam.mccall
[JSON] Add error reporting to fromJSON and ObjectMapper

Translating between JSON objects and C++ strutctures is common.
From experience in clangd, fromJSON/ObjectMapper work well and save a lot of
code, but aren't adopted elsewhere at least partly due to total lack of error
reporting beyond "ok"/"bad".

The recently-added error model should be rich enough for most applications.
It requires tracking the path within the root object and reporting local
errors at appropriate places.
To do this, we exploit the fact that the call graph of recursive
parse functions mirror the structure of the JSON itself.
The current path is represented as a linked list of segments, each of which is
on the stack as a parameter. Concretely, fromJSON now looks like:
  bool fromJSON(const Value&, T&, Path);

Beyond the signature change, this is reasonably unobtrusive: building
the path segments is mostly handled by ObjectMapper and the vector<T> fromJSON.
However the root caller of fromJSON must now create a Root object to
store the errors, which is a little clunky.

I've added high-level parse<T>(StringRef) -> Expected<T>, but it's not
general enough to be the primary interface I think (at least, not usable in
clangd).

All existing users (mostly just clangd) are updated in this patch,
making this change backwards-compatible is a bit hairy.

Differential Revision: https://reviews.llvm.org/D88103
The file was modifiedclang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp
The file was modifiedlldb/source/Utility/StructuredData.cpp
The file was modifiedclang-tools-extra/clangd/index/Index.h
The file was modifiedclang-tools-extra/clangd/Protocol.cpp
The file was modifiedclang-tools-extra/clangd/index/Index.cpp
The file was modifiedllvm/include/llvm/Support/JSON.h
The file was modifiedclang-tools-extra/clangd/ClangdLSPServer.cpp
The file was modifiedllvm/lib/Analysis/TFUtils.cpp
The file was modifiedclang-tools-extra/clangd/ClangdLSPServer.h
The file was modifiedclang-tools-extra/clangd/Protocol.h
The file was modifiedllvm/unittests/Support/JSONTest.cpp
Commit 751f5c81468966d921ad54827d27ff19aa43af8e by sam.mccall
Fix LLDB tweak in 62a47e994fcf5b73e29547d26cd9676b30cb69a3
The file was modifiedlldb/source/Utility/StructuredData.cpp
Commit 23291e8ec7e8f54db56ff77b61313e9d55a23861 by Louis Dionne
[libc++] Fix spurious test failure in -fno-exceptions
The file was modifiedlibcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp
Commit 2bd5e3fb3cc032f90447067d38c48c75b23f32c5 by sam.mccall
[clangd] Improve bad-RPC-payload error messages slightly
The file was modifiedclang-tools-extra/clangd/ClangdLSPServer.h
Commit f5435399e823746bbe1737b95c853d77a42e1ac3 by zequanwu
[CGProfile] don't emit cgprofile entry if called function is dllimport

Differential Revision: https://reviews.llvm.org/D88127
The file was modifiedllvm/test/Instrumentation/cgprofile.ll
The file was modifiedllvm/lib/Transforms/Instrumentation/CGProfile.cpp
Commit ee7ee71f40e904a8380d6439ac4741304b4a2dfd by smeenai
Explicitly specify CMAKE_AR in WinMsvc.cmake

As of cmake 3.18, cmake changes how it searches for compilers for
Windows (see
https://gitlab.kitware.com/cmake/cmake/-/commit/55196a1440e26917d40e6a7a3eb8d9fb323fa657)
and now finds llvm-ar instead of llvm-lib as CMAKE_AR. This explicitly
specifies CMAKE_AR as llvm-lib so the correct program is found.

Reviewed By: smeenai

Differential Revision: https://reviews.llvm.org/D88176
The file was modifiedllvm/cmake/platforms/WinMsvc.cmake
The file was modifiedllvm/cmake/modules/LLVMExternalProjectUtils.cmake