1. Sep 26, 2022
  2. Sep 24, 2022
    • Louis Dionne's avatar
      [libc++] Keep unary_function and binary_function in C++17 for one more release · 8d802f78
      Louis Dionne authored
      In LLVM 15, we added the deprecation markup for unary_function and
      binary_function for >= C++11, and we also removed it for >= C++17.
      While this is in accordance with the Standard, it's also a bit quick
      for our users, since there was no release in which the classes were
      marked as deprecated before their removal.
      
      We noticed widespread breakage due to this, and after months of trying
      to fix downstream failures, I am coming to the conclusion that users
      will be better served if we give them one release where unary_function
      is deprecated but still provided even in >= C++17.
      
      Differential Revision: https://reviews.llvm.org/D134473
      8d802f78
  3. Sep 22, 2022
  4. Sep 20, 2022
  5. Sep 19, 2022
  6. Sep 15, 2022
  7. Sep 14, 2022
    • Shoaib Meenai's avatar
      [MachO] Don't fold compact unwind entries with LSDA · 6fe69891
      Shoaib Meenai authored
      Folding them will cause the unwinder to compute the incorrect function
      start address for the folded entries, which in turn will cause the
      personality function to interpret the LSDA incorrectly and break
      exception handling.
      
      You can verify the end-to-end flow by creating a simple C++ file:
      ```
      void h();
      int main() { h(); }
      ```
      
      and then linking this file against the liblsda.dylib produced by the
      test case added here. Before this change, running the resulting program
      would result in a program termination with an uncaught exception.
      Afterwards, it works correctly.
      
      Reviewed By: #lld-macho, thevinster
      
      Differential Revision: https://reviews.llvm.org/D132845
      
      (cherry picked from commit 56bd3185)
      6fe69891
    • Shoaib Meenai's avatar
      [MachO] Fix dead-stripping __eh_frame · a5ae700c
      Shoaib Meenai authored
      This section is marked S_ATTR_LIVE_SUPPORT in input files, which meant
      that on arm64, we were unnecessarily preserving FDEs if we e.g. had
      multiple weak definitions for a function. Worse, we would actually
      produce an invalid `__eh_frame` section in that case, because the CIE
      associated with the unnecessary FDE would still get dead-stripped and
      we'd end up with a dangling FDE. We set up associations from functions
      to their FDEs, so dead-stripping will just work naturally, and we can
      clear S_ATTR_LIVE_SUPPORT from our input `__eh_frame` sections to fix
      dead-stripping.
      
      Reviewed By: #lld-macho, int3
      
      Differential Revision: https://reviews.llvm.org/D132489
      
      (cherry picked from commit a745e479)
      a5ae700c
    • Mark de Wever's avatar
      [libc++][format] Updates feature-test macros. · c51a59d8
      Mark de Wever authored
      During the discussion on the SG-10 mailinglist regarding the format
      feature-test macros voted in during the last plenary it turns out libc++
      can't mark the format feature-test macro as implemented.
      
      According to
        https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#__cpp_lib_format
      the not yet implemented paper
        P1361R2 Integration of chrono with text formatting
      affects the feature test macro.
      
      Note that P1361R2 doesn't mention the feature-test macro nor is there an
      LWG-issue to address the issue. The reporter of the issue didn't recall
      where this requirement exactly has been decided.
      
      Reviewed By: ldionne, #libc
      
      Differential Revision: https://reviews.llvm.org/D133271
      c51a59d8
  8. Sep 12, 2022
    • Jan Ole Hüser's avatar
      [LLD][COFF] Fix writing a map file when range extension thunks are inserted · 92e7ef99
      Jan Ole Hüser authored
      Bug: An assertion fails:
      
          Assertion failed: isa<To>(Val) && "cast<Ty>() argument of incompatible type!",
          file C:\Users\<user>\prog\llvm\llvm-git-lld-bug\llvm\include\llvm/Support/Casting.h, line 578
      
      Bug is triggered, if
      
          - a map file is requested with /MAP, and
          - Architecture is ARMv7, Thumb, and
          - a relative jump (branch instruction) is greater than 16 MiB (2^24)
      
      The reason for the Bug is:
      
          - a Thunk is created for the jump
          - a Symbol for the Thunk is created
              - of type `DefinedSynthetic`
              - in file `Writer.cpp`
              - in function `getThunk`
          - the Symbol has no name
          - when creating the map file, the name of the Symbol is queried
          - the function `Symbol::computeName` of the base class `Symbol`
            casts the `this` pointer to type `DefinedCOFF` (a derived type),
            but the acutal type is `DefinedSynthetic`
          - The in the llvm::cast an assertion fails
      
      Changes:
      
      - Modify regression test to trigger this bug
      - Give the symbol pointing to the thunk a name, to fix the bug
      - Add assertion, that only DefinedCOFF symbols are allowed to have an
        empty name, when the constructor of the base class Symbol is executed
      
      Reviewed By: rnk
      
      Differential Revision: https://reviews.llvm.org/D133201
      
      (cherry picked from commit 4e5a59a3)
      92e7ef99
    • Brad Smith's avatar
      [mlir] Fix building CRunnerUtils on OpenBSD with 15.x · c643956d
      Brad Smith authored
      CRunnerUtils builds as C++11. 9c1d133c broke
      the build on OpenBSD. aligned_alloc() was only introduced in C++17.
      c643956d
    • Nikita Popov's avatar
      [DwarfEhPrepare] Assign dummy debug location for inserted _Unwind_Resume calls (PR57469) · 1a5c5e0f
      Nikita Popov authored
      DwarfEhPrepare inserts calls to _Unwind_Resume into landing pads.
      If _Unwind_Resume happens to be defined in the same module and
      debug info is used, then this leads to a verifier error:
      
        inlinable function call in a function with debug info must
          have a !dbg location
        call void @_Unwind_Resume(ptr %exn.obj) #0
      
      Fix this by assigning a dummy location to the call. (As this
      happens in the backend, inlining is not actually relevant here.)
      
      Fixes https://github.com/llvm/llvm-project/issues/57469.
      
      Differential Revision: https://reviews.llvm.org/D133095
      
      (cherry picked from commit 5134bd43)
      1a5c5e0f
    • Corentin Jabot's avatar
      [Clang] Fix crash in coverage of if consteval. · 3a08ad21
      Corentin Jabot authored
      Clang crashes when encountering an `if consteval` statement.
      This is the minimum fix not to crash.
      The fix is consistent with the current behavior of if constexpr,
      which does generate coverage data for the discarded branches.
      This is of course not correct and a better solution is
      needed for both if constexpr and if consteval.
      See https://github.com/llvm/llvm-project/issues/54419.
      
      Fixes #57377
      
      Reviewed By: aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D132723
      3a08ad21
  9. Sep 08, 2022
  10. Sep 07, 2022
  11. Sep 05, 2022
  12. Sep 04, 2022
  13. Sep 02, 2022
    • Nico Weber's avatar
      [clang] Add __is_target_variant_{os,environment} builtins · 11ba13a6
      Nico Weber authored
      Xcode 13's clang has them. For the included testcase, Xcode's clang
      behaves like the implementation in this patch.
      
      Availability.h in the macOS 12.0 SDK (part of Xcode 13, and the current
      stable version of the macOS SDK) does something like:
      
         #if defined(__has_builtin)
           ...
           #if __has_builtin(__is_target_os)
            #if __has_builtin(__is_target_environment)
             #if __has_builtin(__is_target_variant_os)
              #if __has_builtin(__is_target_variant_environment)
               #if (... && ((__is_target_os(ios) && __is_target_environment(macabi)) || (__is_target_variant_os(ios) && __is_target_variant_environment(macabi))))
                 #define __OSX_AVAILABLE_STARTING(_osx, _ios) ...
                 #define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) ...
                 #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) ...
      
      So if __has_builtin(__is_target_variant_os) or
      __has_builtin(__is_target_variant_environment) are false, these defines are not
      defined.
      
      Most of the time, this doesn't matter. But open-source clang currently fails
      to commpile a file containing only `#include <Security/cssmtype.h>` when
      building for catalyst by adding a `-target arm64-apple-ios13.1-macabi` triple,
      due to those __OSX_AVAILABLE macros not being set correctly.
      
      If a potential future SDK version were to include cssmtype.h transitively
      from a common header such as `<Foundation/Foundation.h>`, then it would become
      close to impossible to build Catalyst binaries with open-source clang.
      
      To fix this for normal catalyst builds, it's only necessary that
      __has_builtin() evaluates to true for these two built-ins -- the implementation
      of them doesn't matter. But as a courtesy, a correct (at least on the test
      cases I tried) implementation is provided. (This should also help people who
      try to build zippered code, where having the correct implementation does
      matter.)
      
      Differential Revision: https://reviews.llvm.org/D132754
      11ba13a6