Skip to content

Commit 9853ecf

Browse files
authored
Merge branch 'main' into wcsncpy-implementation
2 parents a07e523 + a903271 commit 9853ecf

File tree

495 files changed

+19074
-9858
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

495 files changed

+19074
-9858
lines changed

.github/new-prs-labeler.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,12 @@ flang:fir-hlfir:
554554
flang:codegen:
555555
- flang/**/CodeGen/**
556556

557+
llvm:codegen:
558+
- llvm/lib/CodeGen/*
559+
- llvm/lib/CodeGen/MIRParser/*
560+
- llvm/lib/CodeGen/LiveDebugValues/*
561+
- llvm/lib/CodeGen/AsmPrinter/*
562+
557563
llvm:globalisel:
558564
- llvm/**/GlobalISel/**
559565
- llvm/utils/TableGen/GlobalISel*

clang-tools-extra/docs/clang-tidy/checks/modernize/deprecated-headers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ Options
7979
analyzed C++ source file is not included by any other C source files.
8080
Hence, to omit false-positives and wrong fixit-hints, we ignore emitting
8181
reports into header files. One can set this option to `true` if they know
82-
that the header files in the project are only used by C++ source file.
82+
that the header files in the project are only used by C++ source files.
8383
Default is `false`.

clang/docs/LanguageExtensions.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,7 @@ to ``float``; see below for more information on this emulation.
10011001
* X86 (if SSE2 is available; natively if AVX512-FP16 is also available)
10021002
* RISC-V (natively if Zfh or Zhinx is available)
10031003
* SystemZ (emulated)
1004+
* LoongArch (emulated)
10041005

10051006
* ``__bf16`` is supported on the following targets (currently never natively):
10061007

@@ -2042,6 +2043,17 @@ references can be used instead of numeric references.
20422043
return -1;
20432044
}
20442045

2046+
ASM Goto versus Branch Target Enforcement
2047+
=========================================
2048+
2049+
Some target architectures implement branch target enforcement, by requiring
2050+
indirect (register-controlled) branch instructions to jump only to locations
2051+
marked by a special instruction (such as AArch64 ``bti``).
2052+
2053+
The assembler code inside an ``asm goto`` statement is expected not to use a
2054+
branch instruction of that kind to transfer control to any of its destination
2055+
labels. Therefore, using a label in an ``asm goto`` statement does not cause
2056+
clang to put a ``bti`` or equivalent instruction at the label.
20452057

20462058
Constexpr strings in GNU ASM statements
20472059
=======================================

clang/docs/ReleaseNotes.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ Potentially Breaking Changes
4141
- For ARM targets when compiling assembly files, the features included in the selected CPU
4242
or Architecture's FPU are included. If you wish not to use a specific feature,
4343
the relevant ``+no`` option will need to be amended to the command line option.
44+
- When compiling with branch target enforcement, ``asm goto``
45+
statements will no longer guarantee to place a ``bti`` or
46+
``endbr64`` instruction at the labels named as possible branch
47+
destinations, so it is not safe to use a register-controlled branch
48+
instruction to branch to one. (In line with gcc.)
4449

4550
C/C++ Language Potentially Breaking Changes
4651
-------------------------------------------
@@ -310,6 +315,8 @@ Non-comprehensive list of changes in this release
310315
different than before.
311316
- Fixed a crash when a VLA with an invalid size expression was used within a
312317
``sizeof`` or ``typeof`` expression. (#GH138444)
318+
- Deprecation warning is emitted for the deprecated ``__reference_binds_to_temporary`` intrinsic.
319+
``__reference_constructs_from_temporary`` should be used instead. (#GH44056)
313320

314321
New Compiler Flags
315322
------------------
@@ -696,6 +703,15 @@ Bug Fixes to Compiler Builtins
696703
are ``__builtin_is_cpp_trivially_relocatable``. It is recommended to use
697704
``__builtin_trivially_relocate`` instead.
698705

706+
- ``__reference_binds_to_temporary``, ``__reference_constructs_from_temporary``
707+
and ``__reference_converts_from_temporary`` intrinsics no longer consider
708+
function references can bind to temporary objects. (#GH114344)
709+
710+
- ``__reference_constructs_from_temporary`` and
711+
``__reference_converts_from_temporary`` intrinsics detect reference binding
712+
to prvalue instead of xvalue now if the second operand is an object type, per
713+
`LWG3819 <https://cplusplus.github.io/LWG/issue3819>`_.
714+
699715
Bug Fixes to Attribute Support
700716
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
701717
- Fixed crash when a parameter to the ``clang::annotate`` attribute evaluates to ``void``. See #GH119125

clang/docs/UsersManual.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3743,6 +3743,35 @@ Doxygen-style comments and ignores ordinary comments starting with ``//`` and
37433743
``-fcomment-block-commands=foo -fcomment-block-commands=bar`` does the same
37443744
as above.
37453745

3746+
.. _ccc-override-options:
3747+
3748+
CCC_OVERRIDE_OPTIONS
3749+
--------------------
3750+
The environment variable ``CCC_OVERRIDE_OPTIONS`` can be used to edit clang's
3751+
command line arguments. The value of this variable is a space-separated list of
3752+
edits to perform. The edits are applied in the order in which they appear in
3753+
``CCC_OVERRIDE_OPTIONS``. Each edit should be one of the following forms:
3754+
3755+
- ``#``: Silence information about the changes to the command line arguments.
3756+
3757+
- ``^FOO``: Add ``FOO`` as a new argument at the beginning of the command line
3758+
right after the name of the compiler executable.
3759+
3760+
- ``+FOO``: Add ``FOO`` as a new argument at the end of the command line.
3761+
3762+
- ``s/XXX/YYY/``: Substitute the regular expression ``XXX`` with ``YYY`` in the
3763+
command line.
3764+
3765+
- ``xOPTION``: Removes all instances of the literal argument ``OPTION``.
3766+
3767+
- ``XOPTION``: Removes all instances of the literal argument ``OPTION``, and the
3768+
following argument.
3769+
3770+
- ``Ox``: Removes all flags matching ``O`` or ``O[sz0-9]`` and adds ``Ox`` at
3771+
the end of the command line.
3772+
3773+
This environment variable does not affect the options added by the config files.
3774+
37463775
.. _c:
37473776

37483777
C Language Features

clang/include/clang/Basic/BuiltinsBase.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- BuiltinsBase.td - common structured used by builtins ---*- C++ -*-===//
1+
//===--- BuiltinsBase.td - common structured used by builtins -------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

clang/include/clang/CIR/CIRGenerator.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,49 @@ class CIRGenerator : public clang::ASTConsumer {
4343

4444
const clang::CodeGenOptions &codeGenOpts;
4545

46+
unsigned handlingTopLevelDecls;
47+
48+
/// Use this when emitting decls to block re-entrant decl emission. It will
49+
/// emit all deferred decls on scope exit. Set EmitDeferred to false if decl
50+
/// emission must be deferred longer, like at the end of a tag definition.
51+
struct HandlingTopLevelDeclRAII {
52+
CIRGenerator &self;
53+
bool emitDeferred;
54+
HandlingTopLevelDeclRAII(CIRGenerator &self, bool emitDeferred = true)
55+
: self{self}, emitDeferred{emitDeferred} {
56+
++self.handlingTopLevelDecls;
57+
}
58+
~HandlingTopLevelDeclRAII() {
59+
unsigned Level = --self.handlingTopLevelDecls;
60+
if (Level == 0 && emitDeferred)
61+
self.emitDeferredDecls();
62+
}
63+
};
64+
4665
protected:
4766
std::unique_ptr<mlir::MLIRContext> mlirContext;
4867
std::unique_ptr<clang::CIRGen::CIRGenModule> cgm;
4968

69+
private:
70+
llvm::SmallVector<clang::FunctionDecl *, 8> deferredInlineMemberFuncDefs;
71+
5072
public:
5173
CIRGenerator(clang::DiagnosticsEngine &diags,
5274
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
5375
const clang::CodeGenOptions &cgo);
5476
~CIRGenerator() override;
5577
void Initialize(clang::ASTContext &astContext) override;
5678
bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
79+
void HandleInlineFunctionDefinition(clang::FunctionDecl *d) override;
5780
void CompleteTentativeDefinition(clang::VarDecl *d) override;
5881

5982
mlir::ModuleOp getModule() const;
6083
mlir::MLIRContext &getMLIRContext() { return *mlirContext; };
6184
const mlir::MLIRContext &getMLIRContext() const { return *mlirContext; };
6285

6386
bool verifyModule() const;
87+
88+
void emitDeferredDecls();
6489
};
6590

6691
} // namespace cir

clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,24 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
300300
return createBinop(loc, lhs, cir::BinOpKind::Or, rhs);
301301
}
302302

303+
mlir::Value createSelect(mlir::Location loc, mlir::Value condition,
304+
mlir::Value trueValue, mlir::Value falseValue) {
305+
assert(trueValue.getType() == falseValue.getType() &&
306+
"trueValue and falseValue should have the same type");
307+
return create<cir::SelectOp>(loc, trueValue.getType(), condition, trueValue,
308+
falseValue);
309+
}
310+
311+
mlir::Value createLogicalAnd(mlir::Location loc, mlir::Value lhs,
312+
mlir::Value rhs) {
313+
return createSelect(loc, lhs, rhs, getBool(false, loc));
314+
}
315+
316+
mlir::Value createLogicalOr(mlir::Location loc, mlir::Value lhs,
317+
mlir::Value rhs) {
318+
return createSelect(loc, lhs, getBool(true, loc), rhs);
319+
}
320+
303321
mlir::Value createMul(mlir::Location loc, mlir::Value lhs, mlir::Value rhs,
304322
OverflowBehavior ob = OverflowBehavior::None) {
305323
auto op =

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,15 @@ struct MissingFeatures {
137137
static bool recordZeroInit() { return false; }
138138
static bool zeroSizeRecordMembers() { return false; }
139139

140-
// Misc
140+
// CXXABI
141141
static bool cxxABI() { return false; }
142+
static bool cxxabiThisAlignment() { return false; }
143+
static bool cxxabiUseARMMethodPtrABI() { return false; }
144+
static bool cxxabiUseARMGuardVarABI() { return false; }
145+
static bool cxxabiAppleARM64CXXABI() { return false; }
146+
static bool cxxabiStructorImplicitParam() { return false; }
147+
148+
// Misc
142149
static bool cirgenABIInfo() { return false; }
143150
static bool abiArgInfo() { return false; }
144151
static bool tryEmitAsConstant() { return false; }
@@ -187,7 +194,6 @@ struct MissingFeatures {
187194
static bool typeChecks() { return false; }
188195
static bool lambdaFieldToName() { return false; }
189196
static bool updateCompletedType() { return false; }
190-
static bool targetSpecificCXXABI() { return false; }
191197
static bool moduleNameHash() { return false; }
192198
static bool constantFoldSwitchStatement() { return false; }
193199
static bool cudaSupport() { return false; }
@@ -196,13 +202,14 @@ struct MissingFeatures {
196202
static bool constEmitterVectorILE() { return false; }
197203
static bool needsGlobalCtorDtor() { return false; }
198204
static bool emitTypeCheck() { return false; }
199-
static bool cxxabiThisDecl() { return false; }
200-
static bool cxxabiThisAlignment() { return false; }
201205
static bool writebacks() { return false; }
202206
static bool cleanupsToDeactivate() { return false; }
203207
static bool stackBase() { return false; }
204208
static bool deferredDecls() { return false; }
205209
static bool setTargetAttributes() { return false; }
210+
static bool coverageMapping() { return false; }
211+
static bool peepholeProtection() { return false; }
212+
static bool instrumentation() { return false; }
206213

207214
// Missing types
208215
static bool dataMemberType() { return false; }
@@ -227,8 +234,9 @@ struct MissingFeatures {
227234
static bool ptrDiffOp() { return false; }
228235
static bool ptrStrideOp() { return false; }
229236
static bool switchOp() { return false; }
230-
static bool ternaryOp() { return false; }
237+
static bool throwOp() { return false; }
231238
static bool tryOp() { return false; }
239+
static bool vecTernaryOp() { return false; }
232240
static bool zextOp() { return false; }
233241

234242
// Future CIR attributes

clang/include/clang/Lex/Preprocessor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ enum class EmbedResult {
132132
struct CXXStandardLibraryVersionInfo {
133133
enum Library { Unknown, LibStdCXX };
134134
Library Lib;
135-
unsigned Version;
135+
std::uint64_t Version;
136136
};
137137

138138
/// Engages in a tight little dance with the lexer to efficiently
@@ -2717,8 +2717,8 @@ class Preprocessor {
27172717
std::optional<CXXStandardLibraryVersionInfo> CXXStandardLibraryVersion;
27182718

27192719
public:
2720-
std::optional<unsigned> getStdLibCxxVersion();
2721-
bool NeedsStdLibCxxWorkaroundBefore(unsigned FixedVersion);
2720+
std::optional<std::uint64_t> getStdLibCxxVersion();
2721+
bool NeedsStdLibCxxWorkaroundBefore(std::uint64_t FixedVersion);
27222722

27232723
private:
27242724
//===--------------------------------------------------------------------===//

0 commit comments

Comments
 (0)