aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaChecking.cpp
AgeCommit message (Collapse)AuthorFilesLines
2024-03-08[clang] Fix -Wunused-variable in SemaChecking.cpp (NFC)Jie Fu1-2/+4
llvm-project/clang/lib/Sema/SemaChecking.cpp:19192:15: error: unused variable 'Field1Parent' [-Werror,-Wunused-variable] const Type *Field1Parent = Field1->getParent()->getTypeForDecl(); ^ llvm-project/clang/lib/Sema/SemaChecking.cpp:19193:15: error: unused variable 'Field2Parent' [-Werror,-Wunused-variable] const Type *Field2Parent = Field2->getParent()->getTypeForDecl(); ^ 2 errors generated.
2024-03-08[clang] Respect field alignment in layout compatibility of structs (#84313)Vlad Serebrennikov1-2/+21
This patch implements [CWG2586](https://cplusplus.github.io/CWG/issues/2583.html) "Common initial sequence should consider over-alignment". Note that alignment of union members doesn't have to match, as layout compatibility of unions is not defined in terms of common initial sequence (http://eel.is/c++draft/class.mem.general#25).
2024-03-06[clang][Sema] Warn on self move for inlined static cast (#76646)Max Winkler1-10/+9
There are code bases that inline `std::move` manually via `static_cast`. Treat a static cast to an xvalue as an inlined `std::move` call and warn on a self move.
2024-03-06[clang][NFC] Trim license header comments to 81 characters (#82919)Balazs Benics1-1/+1
clang-format would format these headers poorly by splitting it into multiple lines.
2024-03-06[AMDGPU] Implement 'llvm.get.fpenv' and 'llvm.set.fpenv' (#83906)Joseph Huber1-0/+3
Summary: This patch implements the LLVM floating point environment control intrinsics and also exposes it through clang. We encode the floating point environment as a 64-bit value that simply concatenates the values of the mode registers and the current trap status. We only fetch the bits relevant for floating point instructions. That is, rounding mode, denormalization mode, ieee, dx10 clamp, debug, enabled traps, f16 overflow, and active exceptions.
2024-03-06[clang][RISCV] Reorder sema check for RVV type (#83553)Brandon Wu1-5/+6
Currently using the command `clang -cc1 -triple riscv64` to compile the code below: ``` #include <riscv_vector.h> void foo() { vfloat64m1_t f64m1; } ``` would get the error message "RISC-V type 'vfloat64m1_t' ... requires the 'zve64x' extension" which is supposed to be "RISC-V type 'vfloat64m1_t' ... requires the 'zve64d' extension".
2024-03-05[HLSL] implement the rcp intrinsic (#83857)Farzon Lotfi1-0/+1
This PR implements the frontend for llvm#70100 This PR is part 1 of 2. Part 2 requires an intrinsic to instructions lowering. - `Builtins.td` - add an `rcp` builtin - `CGBuiltin.cpp` - add the builtin to intrinsic lowering - `hlsl_intrinsics.h` - add the `rcp` api - `SemaChecking.cpp` - reuse frac's sema checks - `IntrinsicsDirectX.td` - add the llvm intrinsic
2024-03-05[HLSL] implement the any intrinsic (#83903)Farzon Lotfi1-0/+5
This PR implements the frontend for #70076 This PR is part 1 of 2. Part 2 requires an intrinsic to instructions lowering. - `Builtins.td` - add an `any` builtin - `CGBuiltin.cpp` add the builtin to intrinsic lowering - `hlsl_basic_types.h` -add the `bool` vectors since that is an input for any - `hlsl_intrinsics.h` - add the `any` api - `SemaChecking.cpp` - addy `any` builtin checking - `IntrinsicsDirectX.td` - add the llvm intrinsic
2024-03-05[HLSL] implement `mad` intrinsic (#83826)Farzon Lotfi1-5/+23
This change implements #83736 The dot product lowering needs a tertiary multipy add operation. DXIL has three mad opcodes for `fmad`(46), `imad`(48), and `umad`(49). Dot product in DXIL only uses `imad`\ `umad`, but for completeness and because the hlsl `mad` intrinsic requires it `fmad` was also included. Two new intrinsics were needed to be created to complete this change. the `fmad` case already supported by llvm via `fmuladd` intrinsic. - `hlsl_intrinsics.h` - exposed mad api call. - `Builtins.td` - exposed a `mad` builtin. - `Sema.h` - make `tertiary` calls check for float types optional. - `CGBuiltin.cpp` - pick the intrinsic for singed\unsigned & float also reuse `int_fmuladd`. - `SemaChecking.cpp` - type checks for `__builtin_hlsl_mad`. - `IntrinsicsDirectX.td` create the two new intrinsics for `imad`\`umad`/ - `DXIL.td` - create the llvm intrinsic to `DXIL` opcode mapping. --------- Co-authored-by: Farzon Lotfi <farzon@farzon.com>
2024-03-05[clang] Sequence C++20 Parenthesized List Init (#83476)Douglas Deslauriers1-16/+14
Parenthesized list intializers are sequenced operations, see C++20 [decl.init]p16.5 and [decl.init]p16.6.2.2 for more details. Fixes #83474
2024-03-01[clang][sema] consolidate diags for incompatible_vector_* (#83609)Farzon Lotfi1-10/+14
removing the additions of `err_vec_builtin_non_vector_all` & `err_vec_builtin_incompatible_vector_all` caused by https://github.com/llvm/llvm-project/pull/83077. Instead adding a select option to `err_vec_builtin_non_vector` & `err_vec_builtin_incompatible_vector` to account for uses where there are more than two arguments.
2024-03-01[Sema] -Wpointer-bool-conversion: suppress lambda function pointer ↵Fangrui Song1-7/+10
conversion diagnostic during instantiation (#83497) I have seen two internal pieces of code that uses a template type parameter to accept any callable type (function pointer, std::function, closure type, etc). The diagnostic added in #83152 would require adaptation to the template, which is difficult and also seems unnecessary. Example: ```cpp template <typename... Ts> static bool IsFalse(const Ts&...) { return false; } template <typename T, typename... Ts, typename = typename std::enable_if<std::is_constructible<bool, const T&>::value>::type> static bool IsFalse(const T& p, const Ts&...) { return p ? false : true; } template <typename... Args> void Init(Args&&... args) { if (IsFalse(absl::implicit_cast<const typename std::decay<Args>::type&>( args)...)) { // A callable object convertible to false is either a null pointer or a // null functor (e.g., a default-constructed std::function). empty_ = true; } else { empty_ = false; new (&factory_) Factory(std::forward<Args>(args)...); } } ```
2024-03-01[X86][AArch64][PowerPC] __builtin_cpu_supports accepts unknown options. (#83515)Pavel Iliin1-3/+5
The patch fixes https://github.com/llvm/llvm-project/issues/83407 modifing __builtin_cpu_supports behaviour so that it returns false if unsupported features names provided in parameter and issue a warning. __builtin_cpu_supports is target independent, but currently supported by X86, AArch64 and PowerPC only.
2024-02-29[HLSL] Implementation of the frac intrinsic (#83315)Farzon Lotfi1-0/+26
This change implements the frontend for #70099 Builtins.td - add the frac builtin CGBuiltin.cpp - add the builtin to DirectX intrinsic mapping hlsl_intrinsics.h - add the frac api SemaChecking.cpp - add type checks for builtin IntrinsicsDirectX.td - add the frac intrinsic The backend changes for this are going to be very simple: https://github.com/llvm/llvm-project/commit/f309a0eb558b65dfaff0d1d23b7d07fb07e27121 They were not included because llvm/lib/Target/DirectX/DXIL.td is going through a major refactor.
2024-02-29[HLSL] implementation of lerp intrinsic (#83077)Farzon Lotfi1-27/+42
This is the start of implementing the lerp intrinsic https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-lerp Builtins.td - defines the builtin hlsl_intrinsics.h - defines the lerp api DiagnosticSemaKinds.td - needed a new error to be inclusive for more than two operands. CGBuiltin.cpp - add the lerp intrinsic lowering SemaChecking.cpp - type checks for lerp builtin IntrinsicsDirectX.td - define the lerp intrinsic this change implements the first half of #70102 Co-authored-by: Xiang Li <python3kgae@outlook.com>
2024-02-29[Clang][Sema]: Diagnose lambda to bool implicit casts (#83152)Vinayak Dev1-0/+11
Adds diagnostics for lambda expressions being cast to boolean values, which results in the expression always evaluating to true. Earlier, Clang allowed compilation of such erroneous programs, but now emits a warning through `-Wpointer-bool-conversion`. Fixes #82512
2024-02-28[clang] Fix __builtin_popcountg not matching GCC (#83313)OverMighty1-4/+10
Our implementation previously accepted signed arguments and performed integer promotion on the argument. GCC's implementation requires an unsigned argument and does not perform integer promotion on it.
2024-02-27[Clang][Sema] Fix missing warning when comparing mismatched enums in … ↵Kupa-Martin1-9/+2
(#81418) …C mode Factored logic from `CheckImplicitConversion` into new methods `Expr::getEnumConstantDecl` and `Expr::getEnumCoercedType` for use in `checkEnumArithmeticConversions`. Fix #29217
2024-02-26[clang] Implement __builtin_popcountg (#82359)OverMighty1-0/+22
Fixes #82058.
2024-02-26[HLSL] Implementation of dot intrinsic (#81190)Farzon Lotfi1-8/+95
This change implements https://github.com/llvm/llvm-project/issues/70073 HLSL has a dot intrinsic defined here: https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-dot The intrinsic itself is defined as a HLSL_LANG LangBuiltin in Builtins.td. This is used to associate all the dot product typdef defined hlsl_intrinsics.h with a single intrinsic check in CGBuiltin.cpp & SemaChecking.cpp. In IntrinsicsDirectX.td we define the llvmIR for the dot product. A few goals were in mind for this IR. First it should operate on only vectors. Second the return type should be the vector element type. Third the second parameter vector should be of the same size as the first parameter. Finally `a dot b` should be the same as `b dot a`. In CGBuiltin.cpp hlsl has built on top of existing clang intrinsics via EmitBuiltinExpr. Dot product though is language specific intrinsic and so is guarded behind getLangOpts().HLSL. The call chain looks like this: EmitBuiltinExpr -> EmitHLSLBuiltinExp EmitHLSLBuiltinExp dot product intrinsics makes a destinction between vectors and scalars. This is because HLSL supports dot product on scalars which simplifies down to multiply. Sema.h & SemaChecking.cpp saw the addition of CheckHLSLBuiltinFunctionCall, a language specific semantic validation that can be expanded for other hlsl specific intrinsics. Fixes #70073
2024-02-22[clang] Implement CWG2759 "`[[no_unique_address]` and common initial ↵Vlad Serebrennikov1-0/+3
sequence" (#82607) This patch implements said defect report resolution by adding additional check to common initial sequence evaluation. Consequently, this fixes CWG2759.
2024-02-22[AIX] Lower intrinsic __builtin_cpu_is into AIX platform-specific code. (#80069)zhijian lin1-1/+4
On AIX OS, __builtin_cpu_is() references the runtime external variable _system_configuration from /usr/include/sys/systemcfg.h. ref issue: https://github.com/llvm/llvm-project/issues/80042
2024-02-21[clang] Implement CWG1719 "Layout compatibility and cv-qualification ↵Vlad Serebrennikov1-6/+7
revisited" (#82358) This patch updates our internal notion of `layout-compatible` to ignore cv-qualification, which in turn fixes `__is_layout_compatible` intrinsic.
2024-02-20[clang] Implement `__is_layout_compatible` (#81506)Vlad Serebrennikov1-0/+4
This patch implements `__is_layout_compatible` intrinsic, which supports `std::is_layout_compatible` type trait introduced in C++20 ([P0466R5](https://wg21.link/p0466r5) "Layout-compatibility and Pointer-interconvertibility Traits"). Name matches GCC and MSVC intrinsic. Basically, this patch exposes our existing machinery for checking for layout compatibility and figuring out common initial sequences. Said machinery is a bit outdated, as it doesn't implement [CWG1719](https://cplusplus.github.io/CWG/issues/1719.html) "Layout compatibility and cv-qualification revisited" and [CWG2759](https://cplusplus.github.io/CWG/issues/2759.html) "`[[no_unique_address]` and common initial sequence". Those defect reports are considered out of scope of of this PR, but will be implemented in subsequent PRs. Partially addresses #48204
2024-02-15[HLSL] Vector standard conversions (#71098)Chris B1-2/+9
HLSL supports vector truncation and element conversions as part of standard conversion sequences. The vector truncation conversion is a C++ second conversion in the conversion sequence. If a vector truncation is in a conversion sequence an element conversion may occur after it before the standard C++ third conversion. Vector element conversions can be boolean conversions, floating point or integral conversions or promotions. [HLSL Draft Specification](https://microsoft.github.io/hlsl-specs/specs/hlsl.pdf) --------- Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-02-12[clang][Sema][NFC] Use auto for dyn_cast<>Timm Bäder1-7/+5
2024-02-11[clang][NFC] Annotate `SemaChecking.cpp` with `preferred_type`Vlad Serebrennikov1-0/+1
This helps debuggers to display values in bit-fields in a more helpful way.
2024-02-08[clang] Use CPlusPlus language option instead of Bool (#80975)Mariya Podchishchaeva1-4/+4
As it was pointed out in https://github.com/llvm/llvm-project/pull/80724, we should not be checking `getLangOpts().Bool` when determining something related to logical operators, since it only indicates that bool keyword is present, not which semantic logical operators have. As a side effect a missing `-Wpointer-bool-conversion` in OpenCL C was restored since like C23, OpenCL C has bool keyword but logical operators still return int.
2024-02-08[clang][NFC] resolve redundant predicates (#79701)Rageking81-4/+4
Fixes #79686
2024-02-02[Clang][AArch64] Emit 'unimplemented' diagnostic for SME (#80295)Sander de Smalen1-27/+23
When a function F has ZA and ZT0 state, calls another function G that only shares ZT0 state with its caller, F will have to save ZA before the call to G, and restore it afterwards (rather than setting up a lazy-sve). This is not yet implemented in LLVM and does not result in a compile-time error either. So instead of silently generating incorrect code, it's better to emit an error saying this is not yet implemented.
2024-01-31[clang] static operators should evaluate object argument (reland) (#80108)Tianlan Zhou1-3/+2
This re-applies 30155fc0 with a fix for clangd. ### Description clang don't evaluate the object argument of `static operator()` and `static operator[]` currently, for example: ```cpp #include <iostream> struct Foo { static int operator()(int x, int y) { std::cout << "Foo::operator()" << std::endl; return x + y; } static int operator[](int x, int y) { std::cout << "Foo::operator[]" << std::endl; return x + y; } }; Foo getFoo() { std::cout << "getFoo()" << std::endl; return {}; } int main() { std::cout << getFoo()(1, 2) << std::endl; std::cout << getFoo()[1, 2] << std::endl; } ``` `getFoo()` is expected to be called, but clang don't call it currently (17.0.6). This PR fixes this issue. Fixes #67976, reland #68485. ### Walkthrough - **clang/lib/Sema/SemaOverload.cpp** - **`Sema::CreateOverloadedArraySubscriptExpr` & `Sema::BuildCallToObjectOfClassType`** Previously clang generate `CallExpr` for static operators, ignoring the object argument. In this PR `CXXOperatorCallExpr` is generated for static operators instead, with the object argument as the first argument. - **`TryObjectArgumentInitialization`** `const` / `volatile` objects are allowed for static methods, so that we can call static operators on them. - **clang/lib/CodeGen/CGExpr.cpp** - **`CodeGenFunction::EmitCall`** CodeGen changes for `CXXOperatorCallExpr` with static operators: emit and ignore the object argument first, then emit the operator call. - **clang/lib/AST/ExprConstant.cpp** - **`‎ExprEvaluatorBase::handleCallExpr‎`** Evaluation of static operators in constexpr also need some small changes to work, so that the arguments won't be out of position. - **clang/lib/Sema/SemaChecking.cpp** - **`Sema::CheckFunctionCall`** Code for argument checking also need to be modify, or it will fail the test `clang/test/SemaCXX/overloaded-operator-decl.cpp`. - **clang-tools-extra/clangd/InlayHints.cpp** - **`InlayHintVisitor::VisitCallExpr`** Now that the `CXXOperatorCallExpr` for static operators also have object argument, we should also take care of this situation in clangd. ### Tests - **Added:** - **clang/test/AST/ast-dump-static-operators.cpp** Verify the AST generated for static operators. - **clang/test/SemaCXX/cxx2b-static-operator.cpp** Static operators should be able to be called on const / volatile objects. - **Modified:** - **clang/test/CodeGenCXX/cxx2b-static-call-operator.cpp** - **clang/test/CodeGenCXX/cxx2b-static-subscript-operator.cpp** Matching the new CodeGen. ### Documentation - **clang/docs/ReleaseNotes.rst** Update release notes. --------- Co-authored-by: Shafik Yaghmour <shafik@users.noreply.github.com> Co-authored-by: cor3ntin <corentinjabot@gmail.com> Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-01-30Revert "[clang] static operators should evaluate object argument (#68485)"Aaron Ballman1-2/+3
This reverts commit 30155fc0ef4fbdce2d79434aaae8d58b2fabb20a. It seems to have broken some tests in clangd: http://45.33.8.238/linux/129484/step_9.txt
2024-01-30[Sema] Fix c23 not checking CheckBoolLikeConversion (#79588)Pil Eghoff1-1/+4
Fixes issue #79435 Checks for implicit conversion into boolean was previously triggered by `CheckBoolLikeConversion` for C. When `bool` as a keyword was introduced in C23, `CheckBoolLikeConversion` would no longer trigger when using `-std=c23`, but since logical operators and conditional statements still operate on scalar values, the checks for implicit conversion into bool were never triggered. This fix changes `CheckBoolLikeConversion` to not return early for C23, even though it has support for bools.
2024-01-30[clang] static operators should evaluate object argument (#68485)Tianlan Zhou1-3/+2
### Description clang don't evaluate the object argument of `static operator()` and `static operator[]` currently, for example: ```cpp #include <iostream> struct Foo { static int operator()(int x, int y) { std::cout << "Foo::operator()" << std::endl; return x + y; } static int operator[](int x, int y) { std::cout << "Foo::operator[]" << std::endl; return x + y; } }; Foo getFoo() { std::cout << "getFoo()" << std::endl; return {}; } int main() { std::cout << getFoo()(1, 2) << std::endl; std::cout << getFoo()[1, 2] << std::endl; } ``` `getFoo()` is expected to be called, but clang don't call it currently (17.0.2). This PR fixes this issue. Fixes #67976. ### Walkthrough - **clang/lib/Sema/SemaOverload.cpp** - **`Sema::CreateOverloadedArraySubscriptExpr` & `Sema::BuildCallToObjectOfClassType`** Previously clang generate `CallExpr` for static operators, ignoring the object argument. In this PR `CXXOperatorCallExpr` is generated for static operators instead, with the object argument as the first argument. - **`TryObjectArgumentInitialization`** `const` / `volatile` objects are allowed for static methods, so that we can call static operators on them. - **clang/lib/CodeGen/CGExpr.cpp** - **`CodeGenFunction::EmitCall`** CodeGen changes for `CXXOperatorCallExpr` with static operators: emit and ignore the object argument first, then emit the operator call. - **clang/lib/AST/ExprConstant.cpp** - **`‎ExprEvaluatorBase::handleCallExpr‎`** Evaluation of static operators in constexpr also need some small changes to work, so that the arguments won't be out of position. - **clang/lib/Sema/SemaChecking.cpp** - **`Sema::CheckFunctionCall`** Code for argument checking also need to be modify, or it will fail the test `clang/test/SemaCXX/overloaded-operator-decl.cpp`. ### Tests - **Added:** - **clang/test/AST/ast-dump-static-operators.cpp** Verify the AST generated for static operators. - **clang/test/SemaCXX/cxx2b-static-operator.cpp** Static operators should be able to be called on const / volatile objects. - **Modified:** - **clang/test/CodeGenCXX/cxx2b-static-call-operator.cpp** - **clang/test/CodeGenCXX/cxx2b-static-subscript-operator.cpp** Matching the new CodeGen. ### Documentation - **clang/docs/ReleaseNotes.rst** Update release notes. --------- Co-authored-by: Shafik Yaghmour <shafik@users.noreply.github.com> Co-authored-by: cor3ntin <corentinjabot@gmail.com> Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-01-26[PowerPC][X86] Make cpu id builtins target independent and lower for PPC ↵Nemanja Ivanovic1-47/+55
(#68919) Make __builtin_cpu_{init|supports|is} target independent and provide an opt-in query for targets that want to support it. Each target is still responsible for their specific lowering/code-gen. Also provide code-gen for PowerPC. I originally proposed this in https://reviews.llvm.org/D152914 and this addresses the comments I received there. --------- Co-authored-by: Nemanja Ivanovic <nemanjaivanovic@nemanjas-air.kpn> Co-authored-by: Nemanja Ivanovic <nemanja@synopsys.com>
2024-01-26[RISCV][SiFive] Reduce intrinsics of SiFive VCIX extension (#79407)Brandon Wu1-48/+8
This patch models LMUL and SEW as inputs in sf_vc_x_se and sf_vc_i_se, it reduces 42 intrinsics in the lookup table.
2024-01-24[clang] Refactor Builtins.def to be a tablegen file (#68324)Nikolas Klauser1-12/+12
This makes the builtins list quite a bit more verbose, but IMO this is a huge win in terms of readability.
2024-01-23[Clang][AArch64] Add diagnostics for builtins that use ZT0. (#79140)Sander de Smalen1-0/+17
Similar to what we did for ZA, this patch adds diagnostics to flag when using a ZT0 builtin in a function that does not have ZT0 state.
2024-01-23[Clang] Amend SME attributes with support for ZT0. (#77941)Sander de Smalen1-0/+22
This patch builds on top of #76971 and implements support for: * __arm_new("zt0") * __arm_in("zt0") * __arm_out("zt0") * __arm_inout("zt0") * __arm_preserves("zt0")
2024-01-22[CLANG] Add warning when INF or NAN are used in a binary operation or as ↵Zahira Ammarguellat1-6/+42
function argument in fast math mode. (#76873) Check for operations using INF or NaN when in ffast-math mode and generate a warning.
2024-01-19[Clang] Refactor diagnostics for SME builtins. (#78258)Sander de Smalen1-16/+19
The arm_sme.td file was still using `IsSharedZA` and `IsPreservesZA`, which should be changed to match the new state attributes added in #76971. This patch adds `IsInZA`, `IsOutZA` and `IsInOutZA` as the state for the Clang builtins and fixes up the code in SemaChecking and SveEmitter to match. Note that the code is written in such a way that it can be easily extended with ZT0 state (to follow in a future patch).
2024-01-15[Clang][AArch64] Change SME attributes for shared/new/preserved state. (#76971)Sander de Smalen1-9/+18
This patch replaces the `__arm_new_za`, `__arm_shared_za` and `__arm_preserves_za` attributes in favour of: * `__arm_new("za")` * `__arm_in("za")` * `__arm_out("za")` * `__arm_inout("za")` * `__arm_preserves("za")` As described in https://github.com/ARM-software/acle/pull/276. One change is that `__arm_in/out/inout/preserves(S)` are all mutually exclusive, whereas previously it was fine to write `__arm_shared_za __arm_preserves_za`. This case is now represented with `__arm_in("za")`. The current implementation uses the same LLVM attributes under the hood, since `__arm_in/out/inout` are all variations of "shared ZA", so can use the existing `aarch64_pstate_za_shared` attribute in LLVM. #77941 will add support for the new "zt0" state as introduced with SME2.
2024-01-08[Sema] Use StringRef::ltrim (NFC)Kazu Hirata1-1/+1
2024-01-05[Clang][SME] Add IsStreamingOrSVE2p1 (#76975)Sam Tebbs1-1/+16
This patch adds IsStreamingOrSVE2p1 to the applicable builtins and a warning for when those builtins are not used in a streaming or sve2p1 function.
2024-01-04Revert "[Clang][SME] Add IsStreamingOrSVE2p1" (#76973)Sam Tebbs1-16/+1
Reverts llvm/llvm-project#75958 I mistakenly included a commit from my local main after rebasing.
2024-01-04[Clang][SME] Add IsStreamingOrSVE2p1 (#75958)Sam Tebbs1-1/+16
This patch adds IsStreamingOrSVE2p1 to the applicable builtins and a warning for when those builtins are not used in a streaming or sve2p1 function.
2024-01-03[NFC] Fix compilation in C++20 mode with GCC 12Ilya Biryukov1-1/+3
I ran into the following compiler error when trying to build with GCC 12 and `-DCMAKE_CXX_STANDARD=20`: ``` llvm-project/clang/lib/Sema/SemaChecking.cpp:16690:16: required from here /usr/include/c++/12/type_traits:971:30: error: default member initializer for '{anonymous}::SequenceChecker::Usage::UsageExpr' required before the end of its enclosing class ``` The error seems correct, GCC just instantiates the `SmallDenseMap` early and detects it. Clang does not, but that's an acceptable implementation difference as far as the standard is concerned. Move constructor outside the class to avoid this problem.
2023-12-28[RISCV] Use getBuiltinVectorTypeInfo instead of isRVVType.Craig Topper1-6/+8
I'm trying to remove all uses of isRVVType. Fix diagnostic message to report an error for the builtin instead of the type. Though I can't seem to get a test to hit it.
2023-12-27[RISCV] Prevent checkRVVTypeSupport from issuing more than 1 diagnostic. ↵Craig Topper1-9/+9
(#74950) If vector isn't enabled at all, we might hit one of the earlier diagnostics and the requires Zve32x diagnostic. The Zve32x diagnostic would be redundant.
2023-12-27[RISCV] Refactor checkRVVTypeSupport to use BuiltinVectorTypeInfo. (#74949)Craig Topper1-9/+12
We can decompose the type into ElementType and MinSize and use those to perform the checks. This is more efficient than using isRVVType. This also fixes a bug that we didn't disallow vbool64_t on Zve32x.