[all-commits] [llvm/llvm-project] 42d758: [clang] Return `std::string_view` from `TargetInfo...

Stoorx via All-commits all-commits at lists.llvm.org
Mon Apr 24 02:18:10 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 42d758bfa690d898918816509490a55bc50779df
      https://github.com/llvm/llvm-project/commit/42d758bfa690d898918816509490a55bc50779df
  Author: Stoorx <me at stoorx.one>
  Date:   2023-04-24 (Mon, 24 Apr 2023)

  Changed paths:
    M clang/include/clang/Basic/TargetInfo.h
    M clang/lib/Basic/Targets/AArch64.cpp
    M clang/lib/Basic/Targets/AArch64.h
    M clang/lib/Basic/Targets/AMDGPU.h
    M clang/lib/Basic/Targets/ARC.h
    M clang/lib/Basic/Targets/ARM.cpp
    M clang/lib/Basic/Targets/ARM.h
    M clang/lib/Basic/Targets/AVR.h
    M clang/lib/Basic/Targets/BPF.h
    M clang/lib/Basic/Targets/CSKY.h
    M clang/lib/Basic/Targets/DirectX.h
    M clang/lib/Basic/Targets/Hexagon.h
    M clang/lib/Basic/Targets/Lanai.h
    M clang/lib/Basic/Targets/Le64.h
    M clang/lib/Basic/Targets/LoongArch.h
    M clang/lib/Basic/Targets/M68k.cpp
    M clang/lib/Basic/Targets/M68k.h
    M clang/lib/Basic/Targets/MSP430.h
    M clang/lib/Basic/Targets/Mips.h
    M clang/lib/Basic/Targets/NVPTX.h
    M clang/lib/Basic/Targets/PNaCl.h
    M clang/lib/Basic/Targets/PPC.h
    M clang/lib/Basic/Targets/RISCV.h
    M clang/lib/Basic/Targets/SPIR.h
    M clang/lib/Basic/Targets/Sparc.h
    M clang/lib/Basic/Targets/SystemZ.h
    M clang/lib/Basic/Targets/TCE.h
    M clang/lib/Basic/Targets/VE.h
    M clang/lib/Basic/Targets/WebAssembly.h
    M clang/lib/Basic/Targets/X86.h
    M clang/lib/Basic/Targets/XCore.h
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/CodeGen/CGStmt.cpp

  Log Message:
  -----------
  [clang] Return `std::string_view` from `TargetInfo::getClobbers()`

Change the return type of `getClobbers` function from `const char*`
to `std::string_view`. Update the function usages in CodeGen module.

The reasoning of these changes is to remove unsafe `const char*`
strings and prevent unnecessary allocations for constructing the
`std::string` in usages of `getClobbers()` function.

Differential Revision: https://reviews.llvm.org/D148799




More information about the All-commits mailing list