Unverified Commit 0e3cc163 authored by emilylange's avatar emilylange
Browse files

electron_31: fix build after llvm bump



This fixes the following build errors:

~~~
[2607/50420] CXX obj/third_party/perfetto/src/tracing/client_api_without_backends/track_event_legacy.o
FAILED: obj/third_party/perfetto/src/tracing/client_api_without_backends/track_event_legacy.o
clang++ -MD -MF [...]
In file included from ../../third_party/perfetto/src/tracing/track_event_legacy.cc:17:
In file included from ../../third_party/perfetto/include/perfetto/tracing/track_event_legacy.h:26:
In file included from ../../third_party/perfetto/include/perfetto/tracing/track_event.h:20:
../../third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:331:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  331 |     Base::template Trace([](typename Base::TraceContext ctx) { ctx.Flush(); });
      |                    ^
[...]
6 errors generated.
~~~

and

~~~
FAILED: obj/electron/electron_lib/keyboard_util.o
clang++ -MD -MF [...]
../../electron/shell/common/keyboard_util.cc:19:30: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
   19 | constexpr CodeAndShiftedChar KeyboardCodeFromKeyIdentifier(
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../electron/shell/common/keyboard_util.cc:111:33: note: non-constexpr function 'find' cannot be used in a constant expression
  111 |   if (auto* const iter = Lookup.find(str); iter != Lookup.end())
      |                                 ^
../../base/containers/flat_tree.h:310:18: note: declared here
  310 |   const_iterator find(const Key& key) const;
      |                  ^
1 error generated.
~~~

This is happening since staging has been merged into master, which
included both a rustc and llvm bump.

Note that we inherit the llvm that rustc exposes.

Co-Authored-By: default avatarK900 <me@0upti.me>
parent fd313286
Loading
Loading
Loading
Loading
+35 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
  chromium,
  nodejs,
  python3,
  fetchpatch,
  fetchYarnDeps,
  fetchNpmDeps,
  fixup-yarn-lock,
@@ -59,7 +60,40 @@ in

  src = null;

  patches = base.patches;
  patches =
    base.patches
    ++ lib.optionals (lib.versionOlder info.version "32") [
      # Backport a few fixes for -Wmissing-template-arg-list-after-template-kw
      # which only effects the soon-to-be-EOLed electron 31 (chromium M126).
      # https://issues.chromium.org/issues/344680447

      # https://chromium-review.googlesource.com/c/chromium/src/+/5604664
      (fetchpatch {
        url = "https://github.com/chromium/chromium/commit/b0088fa60970412160535c367e2ff53b25b8538e.patch";
        hash = "sha256-eEYO+IN1062iCqVr6eO3UZlGLN376lMXc6UQunJGpdQ=";
      })

      # https://android-review.googlesource.com/c/platform/external/perfetto/+/3114454
      (fetchpatch {
        name = "perfetto-e2f661907a717551235563389977b7468da6d45e.patch";
        url = "https://android.googlesource.com/platform/external/perfetto/+/e2f661907a717551235563389977b7468da6d45e^!?format=TEXT";
        decode = "base64 -d";
        stripLen = 1;
        extraPrefix = "third_party/perfetto/";
        hash = "sha256-5zSAZZI1tR7O4Aui22T/6uyk0RpuIy7XqDD0nwlDySQ=";
      })

      ./electron-31-perfetto-missing-template-arg-list.patch

      # And a finally fix for -Winvalid-constexpr that is happening within the electron patchset.
      # https://github.com/electron/electron/pull/42413/commits/394a26f94a3fbce91e15e80e8e73b9a3ec1f04d1
      (fetchpatch {
        url = "https://github.com/electron/electron/commit/394a26f94a3fbce91e15e80e8e73b9a3ec1f04d1.patch";
        stripLen = 1;
        extraPrefix = "electron/";
        hash = "sha256-lllUUDm1thnC+rH8hBtPBVLRx6Pis5TPEUeQli9z1Mk=";
      })
    ];

  unpackPhase =
    ''
+13 −0
Original line number Diff line number Diff line
diff --git a/include/perfetto/tracing/internal/track_event_data_source.h b/include/perfetto/tracing/internal/track_event_data_source.h
index 1d924b271..dba896262 100644
--- a/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h
+++ b/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h
@@ -1061,7 +1061,7 @@ class TrackEventDataSource
       const TrackType& track,
       std::function<void(protos::pbzero::TrackDescriptor*)> callback) {
     TrackRegistry::Get()->UpdateTrack(track, std::move(callback));
-    Base::template Trace([&](typename Base::TraceContext ctx) {
+    Base::Trace([&](typename Base::TraceContext ctx) {
       TrackEventInternal::WriteTrackDescriptor(
           track, ctx.tls_inst_->trace_writer.get(), ctx.GetIncrementalState(),
           *ctx.GetCustomTlsState(), TrackEventInternal::GetTraceTime());