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

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


  Branch: refs/heads/users/inclyc/check-xadd-return
  Home:   https://github.com/llvm/llvm-project
  Commit: 49ce143aafd9b009016d357422504c59034736a2
      https://github.com/llvm/llvm-project/commit/49ce143aafd9b009016d357422504c59034736a2
  Author: Yingchi Long <i at lyc.dev>
  Date:   2024-05-20 (Mon, 20 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

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