[all-commits] [llvm/llvm-project] c64866: [BPF] report `Invalid usage of the XADD return val...

Yingchi Long via All-commits all-commits at lists.llvm.org
Mon May 20 10:58:18 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c6486633d2656faecea8d7eb426bb22c52ddfd14
      https://github.com/llvm/llvm-project/commit/c6486633d2656faecea8d7eb426bb22c52ddfd14
  Author: Yingchi Long <i at lyc.dev>
  Date:   2024-05-21 (Tue, 21 May 2024)

  Changed paths:
    M llvm/lib/Target/BPF/BPFMIChecking.cpp
    M llvm/test/CodeGen/BPF/xadd.ll

  Log Message:
  -----------
  [BPF] report `Invalid usage of the XADD return value"` elegantly (#92742)

Previously `report_fatal_error` is used for reporting something goes
wrong in the backend, but this is confusing because `report_fatal_error`
basically means there are something unexpected & crashed in the backend.

So, turn this "crash" into an elegant error reporting. After this patch,
clang can diagnose it:

    bpf-crash.c:4:30: error: Invalid usage of the XADD return value
4 | u32 next_event_id() { return __sync_fetch_and_add(&GLOBAL_EVENT_ID,
1); }
        |                              ^
    1 error generated.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list