aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/Sema.cpp
AgeCommit message (Collapse)AuthorFilesLines
2024-09-12Revert "[clang] Extend diagnose_if to accept more detailed warning ↵Kazu Hirata1-3/+2
information (#70976)" This reverts commit 030c6da7af826b641db005be925b20f956c3a6bb. Several build bots are failing: https://lab.llvm.org/buildbot/#/builders/89/builds/6211 https://lab.llvm.org/buildbot/#/builders/157/builds/7578 https://lab.llvm.org/buildbot/#/builders/140/builds/6429
2024-09-12[clang] Extend diagnose_if to accept more detailed warning information (#70976)Nikolas Klauser1-2/+3
This implements parts of the extension proposed in https://discourse.llvm.org/t/exposing-the-diagnostic-engine-to-c/73092/7. Specifically, this makes it possible to specify a diagnostic group in an optional third argument.
2024-09-08Fix GCC Wimplicit-fallthrough warnings. NFC.Simon Pilgrim1-0/+3
2024-08-17[clang][NFC] Clean up `Sema` headersVlad Serebrennikov1-0/+1
When various `Sema*.h` and `Sema*.cpp` files were created, cleanup of `Sema.h` includes and forward declarations was left for the later. Now's the time. This commit touches `Sema.h` and Sema components: 1. Unused includes are removed. 2. Unused forward declarations are removed. 3. Missing includes are added (those files are largely IWYU-clean now). 4. Includes were converted into forward declarations where possible. As this commit focuses on headers, all changes to `.cpp` files were minimal, and were aiming at keeping everything buildable.
2024-08-09[C++20] [Modules] Emit Errors when compiling a non-module source as module ↵Chuanqi Xu1-0/+12
(#102565) Close https://github.com/llvm/llvm-project/issues/101398 The root cause of the issue is that I removed the codes before and failed to recognize it in time and this was not found for a long time due to it only crashes with invalid codes.
2024-08-02Reland "[Modules] Fix using `va_list` with modules and a precompiled header. ↵Volodymyr Sapsai1-0/+7
(#100837)" Fix the false warning > incompatible pointer types passing 'va_list' (aka '__builtin_va_list') to parameter of type 'struct __va_list_tag *' [-Wincompatible-pointer-types] The warning is wrong because both in the function declaration and at the call site we are using `va_list`. When we call `ASTContext::getBuiltinVaListDecl` at a specific moment, we end up re-entering this function which causes creating 2 instances of `BuiltinVaListDecl` and 2 instances of `VaListTagDecl` but the stored instances are unrelated to each other because of the call sequence like getBuiltinVaListDecl CreateX86_64ABIBuiltinVaListDecl VaListTagDecl = TagA indirectly call getBuiltinVaListDecl CreateX86_64ABIBuiltinVaListDecl VaListTagDecl = TagB BuiltinVaListDecl = ListB BuiltinVaListDecl = ListA Now we have `BuiltinVaListDecl == ListA` and `VaListTagDecl == TagB`. For x86_64 '__builtin_va_list' and 'struct __va_list_tag *' are compatible because '__builtin_va_list' == '__va_list_tag[1]'. But because we have unrelated decls for VaListDecl and VaListTagDecl the types are considered incompatible as we are comparing type pointers. Fix the error by creating `BuiltinVaListDecl` before `ASTReader::InitializeSema`, so that during `ASTContext::getBuiltinVaListDecl` ASTReader doesn't try to de-serialize '__builtin_va_list' and to call `ASTContext::getBuiltinVaListDecl` again. Reland with the requirement to have x86 target to avoid errors like > error: unable to create target: 'No available targets are compatible with triple "x86_64-apple-darwin"' rdar://130947515
2024-08-02Revert "[Modules] Fix using `va_list` with modules and a precompiled ↵dyung1-7/+0
header." (#101752) Reverts llvm/llvm-project#100837 The test Modules/builtin-vararg.c is failing on AArch64 build bots: - https://lab.llvm.org/buildbot/#/builders/190/builds/3117 - https://lab.llvm.org/buildbot/#/builders/65/builds/2302 - https://lab.llvm.org/buildbot/#/builders/154/builds/2288 Revert to get the bots back to green.
2024-08-02[Modules] Fix using `va_list` with modules and a precompiled header. (#100837)Volodymyr Sapsai1-0/+7
Fix the false warning > incompatible pointer types passing 'va_list' (aka '__builtin_va_list') to parameter of type 'struct __va_list_tag *' [-Wincompatible-pointer-types] The warning is wrong because both in the function declaration and at the call site we are using `va_list`. When we call `ASTContext::getBuiltinVaListDecl` at a specific moment, we end up re-entering this function which causes creating 2 instances of `BuiltinVaListDecl` and 2 instances of `VaListTagDecl` but the stored instances are unrelated to each other because of the call sequence like getBuiltinVaListDecl CreateX86_64ABIBuiltinVaListDecl VaListTagDecl = TagA indirectly call getBuiltinVaListDecl CreateX86_64ABIBuiltinVaListDecl VaListTagDecl = TagB BuiltinVaListDecl = ListB BuiltinVaListDecl = ListA Now we have `BuiltinVaListDecl == ListA` and `VaListTagDecl == TagB`. For x86_64 '__builtin_va_list' and 'struct __va_list_tag *' are compatible because '__builtin_va_list' == '__va_list_tag[1]'. But because we have unrelated decls for VaListDecl and VaListTagDecl the types are considered incompatible as we are comparing type pointers. Fix the error by creating `BuiltinVaListDecl` before `ASTReader::InitializeSema`, so that during `ASTContext::getBuiltinVaListDecl` ASTReader doesn't try to de-serialize '__builtin_va_list' and to call `ASTContext::getBuiltinVaListDecl` again. rdar://130947515
2024-07-19[Clang] make SVE types known to device targets too (#99446)Emanuele Rocca1-1/+3
For the purpose of preprocessing and declarations in header files, ensure clang accepts SVE types for both device and host targets. Co-authored-by: Sander De Smalen <sander.desmalen@arm.com>
2024-07-17Performance optimizations for function effects (nonblocking attribute etc.) ↵Doug Wyatt1-2/+2
(#96844) - Put new FunctionProtoType trailing objects last. - Inline FunctionEffectsRef::get() - Manually inline FunctionEffectsRef::Profile(). --------- Co-authored-by: Doug Wyatt <dwyatt@apple.com>
2024-07-01[clang][NFC] Move documentation of `Sema` functions into `Sema.h`Vlad Serebrennikov1-53/+0
This patch moves documentation of `Sema` functions from `.cpp` files to `Sema.h` when there was no documentation in the latter, or it can be trivially subsumed. More complicated cases when there's less trivial divergence between documentation attached to declaration and the one attached to implementation are left for a later PR that would require review. It appears that doxygen can find the documentation for a function defined out-of-line even if it's attached to an implementation, and not declaration. But other tools, e.g. clangd, are not as powerful. So this patch significantly improves autocompletion experience for (at least) clangd-based IDEs.
2024-06-24[Clang] Introduce `nonblocking`/`nonallocating` attributes (#84983)Doug Wyatt1-0/+166
Introduce `nonblocking` and `nonallocating` attributes. RFC is here: https://discourse.llvm.org/t/rfc-nolock-and-noalloc-attributes/76837 This PR introduces the attributes, with some changes in Sema to deal with them as extensions to function (proto)types. There are some basic type checks, most importantly, a warning when trying to spoof the attribute (implicitly convert a function without the attribute to one that has it). A second, follow-on pull request will introduce new caller/callee verification. --------- Co-authored-by: Doug Wyatt <dwyatt@apple.com> Co-authored-by: Shafik Yaghmour <shafik.yaghmour@intel.com> Co-authored-by: Aaron Ballman <aaron@aaronballman.com> Co-authored-by: Sirraide <aeternalmail@gmail.com>
2024-06-18[Clang][AMDGPU] Add a new builtin type for buffer rsrc (#94830)Shilei Tian1-0/+8
This patch adds a new builtin type for AMDGPU's buffer rsrc data type, which is effectively an AS 8 pointer. This is needed because we'd like to expose certain intrinsics to users via builtins which take buffer rsrc as argument.
2024-06-14[AArch64] Extend SVE diagnostics. (#94976)Harald van Dijk1-4/+3
The SVE diagnostics were guarded by a FD->hasBody() check that prevented the diagnostic from being emitted for code that still triggered the backend crashes that the errors were meant to avoid, because FD->hasBody() returns false for a function that Clang is currently processing. This is not done for the equivalent RISC-V code, and is not needed for AArch64 either, so remove it. Errors were also emitted in the wrong location, errors were emitted at the called function's location, rather than at the caller's, which meant that just removing the FD->hasBody() check resulted in incomprehensible errors. Change this as well. The aarch64-mangle-sve-vectors.cpp test was using -target-feature wrong which was exposed as a result of these changes. Different target features need to be passed in as different -target-feature options. aarch64-targetattr-arch.c has a test_errors() function that needs to be split in two. Now that svundef_s8() is diagnosed for its use of svint8_t, the "needs target feature sve" diagnostic is no longer emitted, but this affects all calls in the same function. To ensure we still check this for its __crc32cd call, move that into a separate function. Fixes #94766.
2024-06-05[clang] Split up `SemaDeclAttr.cpp` (#93966)Vlad Serebrennikov1-0/+10
This patch moves language- and target-specific functions out of `SemaDeclAttr.cpp`. As a consequence, `SemaAVR`, `SemaM68k`, `SemaMSP430`, `SemaOpenCL`, `SemaSwift` were created (but they are not the only languages and targets affected). Notable things are that `Sema.h` actually grew a bit, because of templated helpers that rely on `Sema` that I had to make available from outside of `SemaDeclAttr.cpp`. I also had to left CUDA-related in `SemaDeclAttr.cpp`, because it looks like HIP is building up on top of CUDA attributes. This is a follow-up to #93179 and continuation of efforts to split `Sema` up. Additional context can be found in #84184 and #92682.
2024-05-30[clang] Introduce target-specific `Sema` components (#93179)Vlad Serebrennikov1-0/+20
This patch introduces `SemaAMDGPU`, `SemaARM`, `SemaBPF`, `SemaHexagon`, `SemaLoongArch`, `SemaMIPS`, `SemaNVPTX`, `SemaPPC`, `SemaSystemZ`, `SemaWasm`. This continues previous efforts to split Sema up. Additional context can be found in #84184 and #92682. I decided to bundle target-specific components together because of their low impact on `Sema`. That said, their impact on `SemaChecking.cpp` is far from low, and I consider it a success. Somewhat accidentally, I also moved Wasm- and AMDGPU-specific function from `SemaDeclAttr.cpp`, because they were exposed in `Sema`. That went well, and I consider it a success, too. I'd like to move the rest of static target-specific functions out of `SemaDeclAttr.cpp` like we're doing with built-ins in `SemaChecking.cpp` .
2024-05-29[HLSL] Default and Relaxed Availability Diagnostics (#92704)Helena Kotas1-0/+4
Implements HLSL availability diagnostics' default and relaxed mode. HLSL availability diagnostics emits errors or warning when unavailable shader APIs are used. Unavailable shader APIs are APIs that are exposed in HLSL code but are not available in the target shader stage or shader model version. In the default mode the compiler emits an error when an unavailable API is found in a code that is reachable from the shader entry point function. In the future this check will also extended to exported library functions (#92073). The relaxed diagnostic mode is the same except the compiler emits a warning. This mode is enabled by ``-Wno-error=hlsl-availability``. See HLSL Availability Diagnostics design doc [here](https://github.com/llvm/llvm-project/blob/main/clang/docs/HLSL/AvailabilityDiagnostics.rst) for more details. Fixes #90095
2024-05-23[clang] Introduce `SemaX86` (#93098)Vlad Serebrennikov1-0/+2
This patch moves `Sema` functions that are specific for x86 into the new `SemaX86` class. This continues previous efforts to split `Sema` up. Additional context can be found in #84184 and #92682.
2024-05-22[clang] Introduce `SemaRISCV` (#92682)Vlad Serebrennikov1-1/+3
This patch moves `Sema` functions that are specific for RISC-V into the new `SemaRISCV` class. This continues previous efforts to split `Sema` up. Additional context can be found in https://github.com/llvm/llvm-project/pull/84184. This PR is somewhat different from previous PRs on this topic: 1. Splitting out target-specific functions wasn't previously discussed. It felt quite natural to do, though. 2. I had to make some static function in `SemaChecking.cpp` member functions of `Sema` in order to use them in `SemaRISCV`. 3. I dropped "RISCV" from identifiers, but decided to leave "RVV" (RISC-V "V" vector extensions) intact. I think it's an idiomatic abbreviation at this point, but I'm open to input from contributors in that area. 4. I repurposed `SemaRISCVVectorLookup.cpp` for `SemaRISCV`. I think this was a successful experiment, which both helps the goal of splitting `Sema` up, and shows a way to approach `SemaChecking.cpp`, which I wasn't sure how to approach before. As we move more target-specific function out of there, we'll gradually make the checking "framework" inside `SemaChecking.cpp` public, which is currently a whole bunch of static functions. This would enable us to move more functions outside of `SemaChecking.cpp`.
2024-05-21[clang] Introduce `SemaPseudoObject` (#92646)Vlad Serebrennikov1-0/+2
This patch moves `Sema` functions that handle pseudo-objects into the new `SemaPseudoObject` class. This continues previous efforts to split `Sema` up. Additional context can be found in #84184. As usual, in order to help reviewing this, formatting changes are split into a separate commit.
2024-05-17[clang] Introduce `SemaCodeCompletion` (#92311)Vlad Serebrennikov1-2/+4
This patch continues previous efforts to split `Sema` up, this time covering code completion. Context can be found in #84184. Dropping `Code` prefix from function names in `SemaCodeCompletion` would make sense, but I think this PR has enough changes already. As usual, formatting changes are done as a separate commit. Hopefully this helps with the review.
2024-05-17[clang][NFC] Remove an unnecessary `const_cast`Vlad Serebrennikov1-1/+1
2024-05-17[Clang][AArch64] Require SVE or SSVE for scalable types. (#91356)Sander de Smalen1-3/+9
Scalable types are only available when: * The function is compiled with +sve * The function is compiled with +sme and the function is executed in Streaming-SVE mode.
2024-05-14Reapply "[Clang] Unify interface for accessing template arguments as written ↵Krystian Stasiowski1-1/+1
for class/variable template specializations (#81642)" (#91393) Reapplies #81642, fixing the crash which occurs when running the lldb test suite.
2024-05-13[clang] Introduce `SemaObjC` (#89086)Vlad Serebrennikov1-8/+6
This is continuation of efforts to split `Sema` up, following the example of OpenMP, OpenACC, etc. Context can be found in https://github.com/llvm/llvm-project/pull/82217 and https://github.com/llvm/llvm-project/pull/84184. I split formatting changes into a separate commit to help reviewing the actual changes.
2024-05-07Revert "[Clang] Unify interface for accessing template arguments as written ↵Adrian Prantl1-1/+1
for class/variable template specializations (#81642)" This reverts commit 7115ed0fff027b65fa76fdfae215ed1382ed1473. This commit broke several LLDB tests. https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/3480/
2024-05-07[Clang] Unify interface for accessing template arguments as written for ↵Krystian Stasiowski1-1/+1
class/variable template specializations (#81642) Our current method of storing the template arguments as written for `(Class/Var)Template(Partial)SpecializationDecl` suffers from a number of flaws: - We use `TypeSourceInfo` to store `TemplateArgumentLocs` for class template/variable template partial/explicit specializations. For variable template specializations, this is a rather unintuitive hack (as we store a non-type specialization as a type). Moreover, we don't ever *need* the type as written -- in almost all cases, we only want the template arguments (e.g. in tooling use-cases). - The template arguments as written are stored in a number of redundant data members. For example, `(Class/Var)TemplatePartialSpecialization` have their own `ArgsAsWritten` member that stores an `ASTTemplateArgumentListInfo` (the template arguments). `VarTemplateSpecializationDecl` has yet _another_ redundant member "`TemplateArgsInfo`" that also stores an `ASTTemplateArgumentListInfo`. This patch eliminates all `(Class/Var)Template(Partial)SpecializationDecl` members which store the template arguments as written, and turns the `ExplicitInfo` member into a `llvm::PointerUnion<const ASTTemplateArgumentListInfo*, ExplicitInstantiationInfo*>` (to avoid unnecessary allocations when the declaration isn't an explicit instantiation). The template arguments as written are now accessed via `getTemplateArgsWritten` in all cases. The "most breaking" change is to AST Matchers, insofar that `hasTypeLoc` will no longer match class template specializations (since they no longer store the type as written).
2024-04-16[clang] Introduce `SemaOpenMP` (#88642)Vlad Serebrennikov1-11/+14
This patch moves OpenMP-related entities out of `Sema` to a newly created `SemaOpenMP` class. This is a part of the effort to split `Sema` up, and follows the recent example of CUDA, OpenACC, SYCL, HLSL. Additional context can be found in https://github.com/llvm/llvm-project/pull/82217, https://github.com/llvm/llvm-project/pull/84184, https://github.com/llvm/llvm-project/pull/87634.
2024-04-13[clang] Introduce `SemaCUDA` (#88559)Vlad Serebrennikov1-8/+10
This patch moves CUDA-related `Sema` function into new `SemaCUDA` class, following the recent example of SYCL, OpenACC, and HLSL. This is a part of the effort to split Sema. Additional context can be found in https://github.com/llvm/llvm-project/pull/82217, https://github.com/llvm/llvm-project/pull/84184, https://github.com/llvm/llvm-project/pull/87634.
2024-04-11[NFC][Clang] Improve const correctness for IdentifierInfo (#79365)Bill Wendling1-3/+2
The IdentifierInfo isn't typically modified. Use 'const' wherever possible.
2024-04-10[clang] Introduce `SemaSYCL` (#88086)Vlad Serebrennikov1-2/+4
This patch moves SYCL-related `Sema` functions into new `SemaSYCL` class, following the recent example of OpenACC and HLSL. This is a part of the effort to split `Sema`. Additional context can be found in #82217, #84184, #87634.
2024-04-08[clang] Introduce `SemaHLSL` (#87912)Vlad Serebrennikov1-0/+2
This patch introduces `SemaHLSL` class, and moves some HLSL-related functions there. No functional changes intended. Removing "HLSL" from function names inside `SemaHLSL` is left for a subsequent PR by HLSL contributors, if they deem that desirable. This is a part of the effort to split `Sema` into smaller manageable parts, and follows the example of OpenACC. See #82217, #84184, #87634 for additional context.
2024-04-06[clang][NFC] Introduce `SemaBase` (#87634)Vlad Serebrennikov1-36/+9
This is a follow-up to #84184. Multiple reviewers there pointed out to me that we should have a common base class for `Sema` and `SemaOpenACC` to avoid code duplication for common helpers like `getLangOpts()`. On top of that, `Diag()` function was requested for `SemaOpenACC`. This patch delivers both. The intent is to keep `SemaBase` as small as possible, as things there are globally available across `Sema` and its parts without any additional effort from usage side. Overused, this can undermine the whole endeavor of splitting `Sema` apart. Apart of shuffling code around, this patch introduces a helper private function `SemaDiagnosticBuilder::getDeviceDeferredDiags()`, the sole purpose of which is to encapsulate member access into (incomplete) `Sema` for function templates defined in the header, where `Sema` can't be complete.
2024-04-01[clang] Factor out OpenACC part of `Sema` (#84184)Vlad Serebrennikov1-1/+2
This patch moves OpenACC parts of `Sema` into a separate class `SemaOpenACC` that is placed in a separate header `Sema/SemaOpenACC.h`. This patch is intended to be a model of factoring things out of `Sema`, so I picked a small OpenACC part. Goals are the following: 1) Split `Sema` into manageable parts. 2) Make dependencies between parts visible. 3) Improve Clang development cycle by avoiding recompiling unrelated parts of the compiler. 4) Avoid compile-time regressions. 5) Avoid notational regressions in the code that uses Sema.
2024-04-01[HLSL] Implement array temporary support (#79382)Chris B1-0/+1
HLSL constant sized array function parameters do not decay to pointers. Instead constant sized array types are preserved as unique types for overload resolution, template instantiation and name mangling. This implements the change by adding a new `ArrayParameterType` which represents a non-decaying `ConstantArrayType`. The new type behaves the same as `ConstantArrayType` except that it does not decay to a pointer. Values of `ConstantArrayType` in HLSL decay during overload resolution via a new `HLSLArrayRValue` cast to `ArrayParameterType`. `ArrayParamterType` values are passed indirectly by-value to functions in IR generation resulting in callee generated memcpy instructions. The behavior of HLSL function calls is documented in the [draft language specification](https://microsoft.github.io/hlsl-specs/specs/hlsl.pdf) under the Expr.Post.Call heading. Additionally the design of this implementation approach is documented in [Clang's documentation](https://clang.llvm.org/docs/HLSL/FunctionCalls.html) Resolves #70123
2024-03-27[clang][RISCV] Enable RVV with function attribute ↵Brandon Wu1-2/+5
__attribute__((target("arch=+v"))) (#83674) It is currently not possible to use "RVV type" and "RVV intrinsics" if the "zve32x" is not enabled globally. However in some cases we may want to use them only in some functions, for instance: ``` #include <riscv_vector.h> __attribute__((target("+zve32x"))) vint32m1_t rvv_add(vint32m1_t v1, vint32m1_t v2, size_t vl) { return __riscv_vadd(v1, v2, vl); } int other_add(int i1, int i2) { return i1 + i2; } ``` , it is supposed to be compilable even the vector is not specified, e.g. `clang -target riscv64 -march=rv64gc -S test.c`.
2024-03-26[NFC][Clang] Fix potential dereferencing of nullptr (#85944)smanna121-1/+1
This patch replaces getAs<> with castAs<> to resolve potential static analyzer bugs for 1. Dereferencing a pointer issue with nullptr FPT when calling ResolveExceptionSpec() in checkEscapingByref(clang::VarDecl *, clang::Sema &). 3. Dereferencing a pointer issue with nullptr ElementTy->getAs() when calling getElementType() in clang::Sema::SemaBuiltinFPClassification(clang::CallExpr *, unsigned int). 4. Dereferencing a pointer issue with nullptr ConvType->getAs() when calling getKeyword() in clang::Sema::ActOnConversionDeclarator(clang::CXXConversionDecl *).
2024-03-25Use timeTraceAsyncProfilerBegin for Source span (#83961)Takuto Ikuta1-3/+4
This fixes incorrect trace for https://github.com/llvm/llvm-project/issues/56554. This shows trace like https://ui.perfetto.dev/#!/?s=aa809778dc50f2b155b062317fa18bbe2bb2fb9175e6282add8121c7c178214e for the case shown in https://github.com/llvm/llvm-project/issues/83236. https://github.com/llvm/llvm-project/pull/83778 is preparing PR. Fix #56554
2024-03-13[C++20] [Modules] Disambuguous Clang module and C++20 Named module furtherChuanqi Xu1-38/+25
This patch tries to make the boundary of clang module and C++20 named module more clear. The changes included: - Rename `TranslationUnitKind::TU_Module` to `TranslationUnitKind::TU_ClangModule`. - Rename `Sema::ActOnModuleInclude` to `Sema::ActOnAnnotModuleInclude`. - Rename `ActOnModuleBegin` to `Sema::ActOnAnnotModuleBegin`. - Rename `Sema::ActOnModuleEnd` to `Sema::ActOnAnnotModuleEnd`. - Removes a warning if we're trying to compile a non-module unit as C++20 module unit. This is not actually useful and makes (the future) implementation unnecessarily complex. This patch meant to be a NFC fix. But it shows that it fixed a bug suprisingly that previously we would surppress the unused-value warning in named modules. Because it shares the same logic with clang modules, which has headers semantics. This shows the change is meaningful.
2024-03-06[clang][NFC] Regroup declarations in `Sema` (#82217)Vlad Serebrennikov1-19/+19
This patch regroups declarations in `Sema` based on the file they are implemented in (e.g. `SemaChecking.cpp`). This allows to logically split `Sema` in 42 groups. No physical separation is done (e.g. splitting `Sema` into multiple classes). Table of contents added at the very beginning of `Sema`. Grouping is reflected in Doxygen commands, so structure of API reference of `Sema` is also significantly improved ([example from official documentation](https://www.doxygen.nl/manual/examples/memgrp/html/class_memgrp___test.html), [comparison of Sema API reference](https://github.com/llvm/llvm-project/pull/82217#issuecomment-1954567763)). While grouping is intentional, as well as each group consisting of `public` declarations followed by `private` ones (without changing access in-between), exact contents and order of declarations of each group is partially carried over from old structure, partially accidental due to time constrains to do the regrouping over the weekend (`Sema` is just enormously big). Data members and inline function definitions in `Sema.h` complicate the matter, since it's not obvious which group they belong to. Further work is expected to refine contents and order of declarations. What is also intentional is some kind of layering, where Concepts group follows template groups, and ObjC, code completion, CUDA, HLSL, OpenACC, OpenMP, and SYCL are all placed at the end of the file, after C and C++ parts of `Sema`. I used `clang-query` to verify that access specifiers were preserved during the process (https://gcc.godbolt.org/z/9johffY9T, thank you @ilya-biryukov). Only the following 3 member types were converted from `private` to `public` because of limitations of the new grouping: `DeclareTargetContextInfo`, `TypoExprState`, `SatisfactionStackEntryTy`. Member initializer list of `Sema` in `Sema.cpp` is rewritten to reflect new order of data members in order to avoid `-Wreorder-ctor`. Since this patch touches almost every line in `Sema.h`, it was considered appropriate to run clang-format on the whole file, and not just on changed lines.
2024-02-16Revert "[AArch64] Add soft-float ABI (#74460)" (#82032)Prabhuk1-34/+0
This reverts commit 9cc98e336980f00cbafcbed8841344e6ac472bdc. Issue: https://github.com/ClangBuiltLinux/linux/issues/1997
2024-02-15[AArch64] Add soft-float ABI (#74460)ostannard1-0/+34
This adds support for the AArch64 soft-float ABI. The specification for this ABI was added by https://github.com/ARM-software/abi-aa/pull/232. Because all existing AArch64 hardware has floating-point hardware, we expect this to be a niche option, only used for embedded systems on R-profile systems. We are going to document that SysV-like systems should only ever use the base (hard-float) PCS variant: https://github.com/ARM-software/abi-aa/pull/233. For that reason, I've not added an option to select the ABI independently of the FPU hardware, instead the new ABI is enabled iff the target architecture does not have an FPU. For testing, I have run this through an ABI fuzzer, but since this is the first implementation it can only test for internal consistency (callers and callees agree on the PCS), not for conformance to the ABI spec.
2024-02-09[clang][sema] Fix -Wunused-function on target_version'd file-scope Fn's (#81167)Jon Roelofs1-1/+2
We should only warn if the default version is the one that is unused. Fixes: https://github.com/llvm/llvm-project/issues/80227
2024-01-20[Sema] Use llvm::all_of (NFC)Kazu Hirata1-1/+1
2024-01-18[Clang][NFC] Rename CXXMethodDecl::isPure -> is VirtualPure (#78463)cor3ntin1-1/+1
To avoid any possible confusion with the notion of pure function and the gnu::pure attribute.
2023-12-12[clang][Sema] Always clear UndefinedButUsed (#73955)Jonas Hahnfeld1-2/+1
Before, it was only cleared if there were undefined entities. This is important for Clang's incremental parsing as used by `clang-repl` that might receive multiple calls to `Sema.ActOnEndOfTranslationUnit`.
2023-12-08[RISCV] Remove Type::isRVVType() and replace with ↵Craig Topper1-1/+1
isRVVSizelessBuiltinType(). NFC These both do the same thing, but some profiling on a Releast+Asserts build suggests isRVVSizelessBuiltinType() is the more efficient version so lets keep that one.
2023-12-06Add SME2 builtins for pfalse and ptrue (#71953)Matthew Devereau1-2/+2
Extend pfalse and ptrue builtins with svcount_t return types to be enabled for sve2p1 and sme2 See https://github.com/ARM-software/acle/pull/217
2023-11-21[APINotes] Introduce APINotes infrastructure in Clang Sema and FrontendEgor Zhdan1-1/+2
This upstreams more of the Clang API Notes functionality that is currently implemented in the Apple fork: https://github.com/apple/llvm-project/tree/next/clang/lib/APINotes This adds the initial Clang APINotes infrastructure to Clang Sema and Clang Frontend. There will shortly be a follow-up patch with the actual usages of this API. I'm splitting these changes into separate PRs to keep the diffs easier to review.
2023-11-09[C++20] [Modules] Allow export from language linkageChuanqi Xu1-2/+0
Close https://github.com/llvm/llvm-project/issues/71347 Previously I misread the concept of module purview. I thought if a declaration attached to a unnamed module, it can't be part of the module purview. But after the issue report, I recognized that module purview is more of a concept about locations instead of semantics. Concretely, the things in the language linkage after module declarations can be exported. This patch refactors `Module::isModulePurview()` and introduces some possible code cleanups.