Commit Graph

32755 Commits

Author SHA1 Message Date
Simon Pilgrim
539e076e1c Fix MSVC "not all control paths return a value" warnings. NFC. 2023-11-03 09:50:09 +00:00
Brandon Wu
74f38df1d1
[RISCV] Support Xsfvfnrclipxfqf extensions (#68297)
FP32-to-int8 Ranged Clip Instructions

https://sifive.cdn.prismic.io/sifive/0aacff47-f530-43dc-8446-5caa2260ece0_xsfvfnrclipxfqf-spec.pdf
2023-11-03 10:52:37 +08:00
Brandon Wu
945d2e6e60
[RISCV] Support Xsfvfwmaccqqq extensions (#68296)
Bfloat16 Matrix Multiply Accumulate Instruction

https://sifive.cdn.prismic.io/sifive/c391d53e-ffcf-4091-82f6-c37bf3e883ed_xsfvfwmaccqqq-spec.pdf
2023-11-03 10:08:26 +08:00
Brandon Wu
65dc96c2cf
[RISCV] Fix wrong implication for zvknhb. (#66860) 2023-11-03 09:32:21 +08:00
Jan Svoboda
6c465a201b
[clang][deps] Skip slow UNHASHED_CONTROL_BLOCK records (#69975)
Deserialization of the `DIAGNOSTIC_OPTIONS` and `HEADER_SEARCH_PATHS`
records is slow and done for every transitively loaded PCM.
Deserialization of these records cannot be skipped, because the words
are VBR6-encoded and we don't store the length of the entire record. We
could either turn them into binary blobs that can be skipped during
deserialization, or skip writing them altogether. This patch takes the
latter approach, since these records are not necessary in scanning PCMs.
The scanner doesn't make any guarantees about the accuracy of
diagnostics, and we always have the same header search paths due to
strict context hashing.

The commit that makes the `DIAGNOSTIC_OPTIONS` record skippable was
originally implemented by @benlangmuir in a downstream repo.
2023-11-02 15:07:58 -07:00
Vlad Serebrennikov
8775947633
[clang][NFC] Refactor clang::Linkage (#71049)
This patch introduces a new enumerator `Invalid = 0`, shifting other enumerators by +1. Contrary to how it might sound, this actually affirms status quo of how this enum is stored in `clang::Decl`:
```
  /// If 0, we have not computed the linkage of this declaration.
  /// Otherwise, it is the linkage + 1.
  mutable unsigned CacheValidAndLinkage : 3;
```
This patch makes debuggers to not be mistaken about enumerator stored in this bit-field. It also converts `clang::Linkage` to a scoped enum.
2023-11-02 20:57:29 +04:00
Vlad Serebrennikov
8a3e4b5f32
[clang][NFC] Annotate Type bit-fields with clang::preferred_type (#70349)
This patch adds `clang::preferred_type` annotations to Type-related bit-fields. At the moment only debug info takes advantage of this annotation. See more in https://github.com/llvm/llvm-project/pull/69104

This patch also propagates underlying type of several enums from bit-field declaration to enum declaration. I don't see how having them diverge helps.
2023-11-02 20:56:39 +04:00
Dan Klishch
43feb3eeb1
[clang] Separate bit-field padding diagnostics into -Wpadded-bitfield (#70978)
The `-Wpadded` diagnostics are usually very noisy and generally not
helpful. However, reporting padding that was introduced in bit-fields is
rather helpful. For example, yesterday in SerenityOS's discord we had
very unpleasant experience of debugging Windows portability issue, and
its root cause was that under `x86_64-pc-windows-msvc` a padding was
introduced for one of the bit-fields.

So, this PR separates bit-field-related padding diagnostics into a new
`-Wpadded-bitfield`. The diagnostic group is also enabled by `-Wpadded`
for compatibility reasons.
2023-11-02 11:52:57 -04:00
Egor Zhdan
f1c9a1c3a5
Revert "Revert "[APINotes] Upstream APINotesOptions""
This re-lands https://github.com/llvm/llvm-project/pull/70827 while
preventing the assertion failure that occurred when generating
`ASTNodeAPI.json` on non-Apple platforms.
2023-11-02 12:39:55 +00:00
Vlad Serebrennikov
98da18344e
[clang] Remove diagnostic that came with [[clang::preferred_type]] (#70632)
https://github.com/llvm/llvm-project/pull/69104 introduce a diagnostic that checked underlying type of an enum against type of bit-field that is annotated with `[[clang::preferred_type]]`. When I tried to introduce this annotation in https://github.com/llvm/llvm-project/pull/70349, it turned out to be too chatty, despite effort to avoid that.
2023-11-02 16:17:17 +04:00
Chuanqi Xu
0d21436114
[C++20] [Modules] Warn if we found #include <filename> in module purview (#69555)
Close https://github.com/llvm/llvm-project/issues/68615.

It is generally wrong to include <filename> in the module purview.
Although there are cases to include files in the module purview,
generally these use cases should include files by quotes instead of by
angles. Here we think the files got included by angles are the system
headers.

This is consistency with MSVC too:
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-by-compiler-version?view=msvc-170#warnings-introduced-in-visual-studio-2022-version-170-compiler-version-1930
2023-11-02 16:40:20 +08:00
Graham Inggs
6266b96420 Add support of the next Ubuntu (Ubuntu 24.04 - Noble Numbat)
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2023-11-01 21:01:19 +01:00
Johannes Doerfert
0e06ddf0f6 Revert "[APINotes] Upstream APINotesOptions"
This reverts commit c0a1857928.

A shared_ptr assertion always triggers causes all bots to fail.
2023-11-01 11:33:25 -07:00
Justin Bogner
1c6c01fbde
[Attributes][HLSL] Teach EnumArgument to refer to an external enum (#70835)
Rather than write a bunch of logic to shepherd between enums with the
same sets of values, add the ability for EnumArgument to refer to an
external enum in the first place.
2023-11-01 11:24:48 -07:00
Egor Zhdan
c0a1857928
[APINotes] Upstream APINotesOptions
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 first compiler options related to API Notes to the
upstream Clang: `-iapinotes-modules` and `-fapinotes-swift-version=`.
However, this does not add the `-fapinotes` flag that enables API Notes,
since the feature is not fully functional yet.
2023-11-01 17:56:39 +00:00
Natalie Chouinard
6c320b434d
[SPIRV] Add -spirv option to DXC driver (#65989)
Add an option to target SPIR-V to the clang-dxc driver, which sets the
target triple's architecture to logical SPIR-V. This does not yet
address the need for a Vulkan target environment in the triple, tracked
in Issue #70051.

Depends on #70330
2023-11-01 13:41:30 -04:00
Vlad Serebrennikov
a8ead56068
[clang][NFC] Rename ArgPassingKind to RecordArgPassingKind (#70955)
During the recent refactoring (b120fe8d32) this enum was moved out of `RecordDecl`. During post-commit review it was found out that its association with `RecordDecl` should be expressed in the name.
2023-11-01 20:38:28 +04:00
Vlad Serebrennikov
24228aef56
[clang][NFC] Improve locality of recently refactored enums (#70943)
This patch moves definition of recently refactored enums closer to the
types where they were originally defined. Since they are scoped enums at
namespace scope now, they can be forward-declared.

Refactorings in question are:
aaba3761db
50dec541f3
b120fe8d32
ae7b20b583
4ad2ada521
49fd28d960
2023-11-01 19:47:06 +04:00
刘雨培
128b3b61fe
[Clang] Defer the instantiation of explicit-specifier until constraint checking completes (#70548)
Modifications:

- Skip the instantiation of the explicit-specifier during Decl
substitution if we are deducing template arguments and the
explicit-specifier is value dependent.

- Instantiate the explicit-specifier after the constraint checking
completes.

- Make `instantiateExplicitSpecifier` a member function in order to
instantiate the explicit-specifier in different stages.


This PR doesn’t defer the instantiation of the explicit specifier for
deduction guides, because I’m not familiar with deduction guides yet.
I’ll dig into it after this PR.

According to my local test, GCC 13 tuple works with this PR.

Fixes #59827.

---------

Co-authored-by: Erich Keane <ekeane@nvidia.com>
2023-11-01 06:45:48 -07:00
Vlad Serebrennikov
65761200ce [clang][NFC] Refactor LinkageSpecDecl::LanguageIDs
This patch converts `LinkageSpecDecl::LanguageIDs` into scoped enum, and moves it to namespace scope, so that it can be forward-declared where required.
2023-11-01 16:44:34 +03:00
Vlad Serebrennikov
aaba3761db [clang][NFC] Refactor ObjCMethodDecl::ImplementationControl
This patch moves `ObjCMethodDecl::ImplementationControl` to a DeclBase.h so that it's complete at the point where corresponsing bit-field is declared. This patch also converts it to a scoped enum `clang::ObjCImplementationControl`.
2023-11-01 13:40:11 +03:00
Vlad Serebrennikov
50dec541f3 [clang][NFC] Refactor OMPDeclareReductionDecl::InitKind
This patch moves `OMPDeclareReductionDecl::InitKind` to DeclBase.h, so that it's complete at the point where corresponding bit-field is declared. This patch also converts it to scoped enum named `OMPDeclareReductionInitKind`
2023-11-01 12:40:13 +03:00
Vlad Serebrennikov
b120fe8d32 [clang][NFC] Refactor ArgPassingKind
This patch moves `RecordDecl::ArgPassingKind` to DeclBase.h to namespace scope, so that it's complete at the time bit-field is declared.
2023-11-01 11:49:59 +03:00
Serge Pavlov
fc7198b799
[clang] Additional FP classification functions (#69041)
C language standard defined library functions `iszero`, `issignaling`
and `issubnormal`, which did not have counterparts among clang builtin
functions. This change adds new functions:

    __builtin_iszero
    __builtin_issubnormal
    __builtin_issignaling

They provide builtin implementation for the missing standard functions.

Pull request: https://github.com/llvm/llvm-project/pull/69041
2023-11-01 12:10:54 +07:00
Vlad Serebrennikov
ae7b20b583 [clang][NFC] Refactor VectorType::VectorKind
This patch moves `VectorKind` to namespace scope, and make it complete at the point its bit-field is declared. It also converts it to a scoped enum.
2023-10-31 21:50:18 +03:00
Vlad Serebrennikov
4ad2ada521 [clang][NFC] Refactor ElaboratedTypeKeyword
This patch moves ElaboratedTypeKeyword before `Type` definition so that the enum is complete where bit-field for it is declared. It also converts it to scoped enum and removes `ETK_` prefix.
2023-10-31 20:46:07 +03:00
Adrian Prantl
1adb898e2d Mark headers as textual and unbreak the modules build 2023-10-31 09:10:50 -07:00
Yueh-Ting (eop) Chen
d4a885fcbc
[Clang][RISCV] Add vcreate intrinsics for RVV non-tuple types (#70355)
riscv-non-isa/rvv-intrinsic-doc#288
2023-10-31 23:23:32 +08:00
Vlad Serebrennikov
49fd28d960 [clang][NFC] Refactor ArrayType::ArraySizeModifier
This patch moves `ArraySizeModifier` before `Type` declaration so that it's complete at `ArrayTypeBitfields` declaration. It's also converted to scoped enum along the way.
2023-10-31 18:06:34 +03:00
Mike Rice
4f5d463505
Remove malformed brief commands in comments (NFC) (#70746)
Co-authored-by: Timm Baeder <tbaeder@redhat.com>
2023-10-31 03:49:53 -07:00
licongtian
a4005e729c [Clang][LoongArch] Support the builtin functions for LASX
This patch does the following work:
- Define the builtin functions for LASX
- Add the header files lasxintrin.h
2023-10-31 15:52:06 +08:00
licongtian
d6bfa33411 [Clang][LoongArch] Support the builtin functions for LSX
This patch does the following work:
- Define the builtin functions for LSX
- Add the header file lsxintrin.h
- Add the immediate number range checking for LSX builtins
2023-10-31 15:52:06 +08:00
licongtian
8d4e35600f [Clang][LoongArch] Support compiler options -mlsx/-mlasx for clang
This patch adds compiler options -mlsx/-mlasx which enables the
instruction sets of LSX and LASX, and sets related predefined macros
according to the options.
2023-10-31 15:52:05 +08:00
serge-sans-paille
8116b6dce7
[clang] Change GetCharAndSizeSlow interface to by-value style
Instead of passing the Size by reference, assuming it is initialized,
return it alongside the expected char result as a POD.

This makes the interface less error prone: previous interface expected
the Size reference to be initialized, and it was often forgotten,
leading to uninitialized variable usage. This patch fixes the issue.

This also generates faster code, as the returned POD (a char and an
unsigned) fits in 64 bits. The speedup according to compile time tracker
reach -O.7%, with a good number of -0.4%. Details are available on

        https://llvm-compile-time-tracker.com/compare.php?from=3fe63f81fcb999681daa11b2890c82fda3aaeef5&to=fc76a9202f737472ecad4d6e0b0bf87a013866f3&stat=instructions:u

And icing on the cake, on my setup it also shaves 2kB out of
libclang-cpp :-)

This is a recommit of d8f5a18b6e for
2023-10-31 00:08:01 +01:00
DaPorkchop_
b45236f133
[clang] Implement constexpr bit_cast for vectors (#66894)
This makes __builtin_bit_cast support converting to and from vector
types in a constexpr context.
2023-10-30 11:15:36 -07:00
cor3ntin
273ceb1337
[Clang] Diagnose defaulted assignment operator with incompatible object parameter (#70176)
Per https://eel.is/c++draft/dcl.fct.def.default#2.2, the explicit object
parameter of a defaulted special member function must be of the same
type as the one of an equivalent implicitly defaulted function, ignoring
references.

Fixes #69233
2023-10-30 16:05:53 +01:00
Egor Zhdan
bb352b6ead
[APINotes] Upstream APINotesReader
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
2023-10-30 14:36:44 +00:00
Yueh-Ting (eop) Chen
e9ff4e4291
[Clang][RISCV] Add vundefine intrinsics for tuple types (#70354)
riscv-non-isa/rvv-intrinsic-doc#288
2023-10-30 21:59:02 +08:00
Nico Weber
1c876ff515 Revert "Perf/lexer faster slow get char and size (#70543)"
This reverts commit d8f5a18b6e.
Breaks build, see:
https://github.com/llvm/llvm-project/pull/70543#issuecomment-1784227421
2023-10-29 21:11:39 -04:00
serge-sans-paille
d8f5a18b6e
Perf/lexer faster slow get char and size (#70543)
Co-authored-by: serge-sans-paille <sguelton@mozilla.com>
2023-10-29 18:17:02 +00:00
Yusra Syeda
703895b131
[clang] Language to String function (#69487)
This PR adds a function which converts the language to string. This is
intended to be used by the z/OS target, see the patch here:
https://github.com/llvm/llvm-project/pull/68926

---------

Co-authored-by: Yusra Syeda <yusra.syeda@ibm.com>
2023-10-27 17:22:49 -04:00
Richard Howell
396b5621f9
[clang] use relative paths for builtin headers during module compilation (#68023)
When including builtin headers as part of a system module, ensure we use
relative paths to those headers. Otherwise the module will fail to compile 
when specifying relative resource directories without extra search paths.
2023-10-27 07:10:46 -07:00
Takuya Shimizu
b88a9f9670
[clang][ExprConst] Fix crash on uninitialized array subobject (#67817)
https://reviews.llvm.org/D146358 was assuming that all subobjects have
their own name (`SubobjectDecl`), but it was not true for array
elements.

Fixes https://github.com/llvm/llvm-project/issues/67317
2023-10-27 14:11:27 +09:00
Chi Chun Chen
391181062f Revert "[OpenMP] Patch for Support to loop bind clause : Checking Parent Region"
This reverts commit 85f6b2fac9.
2023-10-26 16:57:36 -05:00
Fangrui Song
7e42545524
[Driver] Reject unsupported -mcmodel= (#70262)
-mcmodel= is supported for a few architectures. Reject the option for
other architectures.

* -mcmodel= is unsupported on x86-32.
* -mcmodel=large is unsupported for PIC on AArch64.
* -mcmodel= is unsupported for aarch64_32 triples.
* https://reviews.llvm.org/D67066 (for RISC-V) made
-mcmodel=medany/-mcmodel=medlow aliases for all architectures. Restrict
this to RISC-V.
* llvm/lib/Target/Sparc has some small/medium/large support, but the
values listed on https://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html
had been supported before https://reviews.llvm.org/D67066. Consider
-mcmodel= unsupported for Sparc.
* https://reviews.llvm.org/D106371 translated -mcmodel=medium to
-mcmodel=large on AIX, even for 32-bit systems. Retain this behavior but
reject -mcmodel= for other PPC32 systems.

In general the accept/reject behavior is more similar to GCC.

err_drv_invalid_argument_to_option is less clear than
err_drv_unsupported_option_argument. As the supported values are
different for
different architectures, add a
err_drv_unsupported_option_argument_for_target
for better clarity.
2023-10-26 14:15:36 -07:00
serge-sans-paille
a8a6b66a26
[clang] Document -Wglobal-constructors behavior (#68084)
It's a drop in the ocean considering the lack of documentation of our
diagnostics, but it's a start.

Co-authored-by: serge-sans-paille <sguelton@mozilla.com>
2023-10-26 21:09:31 +00:00
Aaron Ballman
09e8ef975d
Diagnose use of VLAs in a coroutine (#70341)
Fixes https://github.com/llvm/llvm-project/issues/65858
2023-10-26 11:59:17 -04:00
Vlad Serebrennikov
a6d0e8791e
[clang][NFC] Refactor enums that hold size of Type and DeclContext bit-fields (#70296)
This patch refactor said enums to hold total size of a bit-field, and not just non-inherited bits. This brings `Type` and `DeclContext` in line with `Comment` and `Stmt`. It also makes it unnecessary to list all transitive bases of a bit-field as unnamed bit-fields, which makes it more friendly towards debuggers.
2023-10-26 19:22:52 +04:00
Egor Zhdan
f3f0672039
[Clang] Fix several -Wdocumentation warnings (NFC)
```
clang/include/clang/Lex/Preprocessor.h:2893:14: warning: parameter 'isEnter:' not found in the function declaration [-Wdocumentation]
  /// \param isEnter: true if this PP is entering a region; otherwise, this PP
             ^~~~~~~~

clang/include/clang/Lex/Preprocessor.h:2895:14: warning: parameter 'Loc:' not found in the function declaration [-Wdocumentation]
  /// \param Loc: the location of the entry or exit of a
             ^~~~

clang/include/clang/Lex/Preprocessor.h:2907:14: warning: parameter 'StartLoc:' not found in the function declaration [-Wdocumentation]
  /// \param StartLoc: output argument. It will be set to the start location of
             ^~~~~~~~~
```
2023-10-26 16:14:23 +01:00
Sunil Kuravinakop
85f6b2fac9 [OpenMP] Patch for Support to loop bind clause : Checking Parent Region
Differential revision: https://reviews.llvm.org/D158266
2023-10-26 05:08:41 -05:00