[all-commits] [llvm/llvm-project] 98ea4b: [ARM, MVE] Make the MVE intrinsics work in C++!

Simon Tatham via All-commits all-commits at lists.llvm.org
Thu Jan 23 06:10:47 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 98ea4b30c2c4e122defce039e29f7023aa2663e7
      https://github.com/llvm/llvm-project/commit/98ea4b30c2c4e122defce039e29f7023aa2663e7
  Author: Simon Tatham <simon.tatham at arm.com>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    A clang/test/CodeGen/arm-mve-intrinsics/cplusplus.cpp
    M clang/utils/TableGen/MveEmitter.cpp

  Log Message:
  -----------
  [ARM,MVE] Make the MVE intrinsics work in C++!

Summary:
Apparently nobody has tried this in months of development. It turns
out that `FunctionDecl::getBuiltinID` will never consider a function
to be a builtin if it is in C++ and not extern "C". So none of the
function declarations in <arm_mve.h> are recognized as builtins when
clang is compiling in C++ mode: it just emits calls to them as
ordinary functions, which then turn out not to exist at link time.

The trivial fix is to wrap most of arm_mve.h in an extern "C".

Added a test in clang/test/CodeGen/arm-mve-intrinsics which checks
basic functioning of the MVE header file in C++ mode. I've filled it
with copies of existing test functions from other files in that
directory, including a few moderately tricky cases of overloading (in
particular one that relies on the strict-polymorphism attribute added
in D72518).

(I considered making //every// test in that directory compile in both
C and C++ mode and check the code generation was identical. But I
think that would increase testing time by more than the value it adds,
and also update_cc_test_checks gets confused when the output function
name varies between RUN lines.)

Reviewers: LukeGeeson, MarkMurrayARM, miyuki, dmgreen

Reviewed By: MarkMurrayARM

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

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




More information about the All-commits mailing list