Skip to content

Commit 509e671

Browse files
committed
Merge from 'master' to 'sycl-web' (#1)
CONFLICT (content): Merge conflict in clang/include/clang/Driver/Driver.h
2 parents 59fe23e + dab859d commit 509e671

File tree

965 files changed

+7261
-2605
lines changed

Some content is hidden

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

965 files changed

+7261
-2605
lines changed

clang-tools-extra/docs/clang-tidy/checks/readability-make-member-function-const.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ways where logical constness and physical constness coincide:
2626

2727
Specifically, this check will not suggest to add a ``const`` to a non-const
2828
method if the method reads a private member variable of pointer type because
29-
that allows to modify the pointee which might not preserve logical constness.
29+
that allows to modify the pointer which might not preserve logical constness.
3030
For the same reason, it does not allow to call private member functions
3131
or member functions on private member variables.
3232

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ New Compiler Flags
104104
simplify access to the many single purpose floating point options. The default
105105
setting is ``precise``.
106106

107+
- The default module cache has moved from /tmp to a per-user cache directory.
108+
By default, this is ~/.cache but on some platforms or installations, this
109+
might be elsewhere. The -fmodules-cache-path=... flag continues to work.
110+
107111
Deprecated Compiler Flags
108112
-------------------------
109113

clang/docs/UsersManual.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ are listed below.
12201220

12211221
* ``-fno-math-errno``
12221222

1223-
* ``-ffinite-math``
1223+
* ``-ffinite-math-only``
12241224

12251225
* ``-fassociative-math``
12261226

@@ -1306,14 +1306,14 @@ are listed below.
13061306
**-f[no-]honor-infinities**
13071307

13081308
If both ``-fno-honor-infinities`` and ``-fno-honor-nans`` are used,
1309-
has the same effect as specifying ``-ffinite-math``.
1309+
has the same effect as specifying ``-ffinite-math-only``.
13101310

13111311
.. _opt_fhonor-nans:
13121312

13131313
**-f[no-]honor-nans**
13141314

13151315
If both ``-fno-honor-infinities`` and ``-fno-honor-nans`` are used,
1316-
has the same effect as specifying ``-ffinite-math``.
1316+
has the same effect as specifying ``-ffinite-math-only``.
13171317

13181318
.. _opt_fsigned-zeros:
13191319

@@ -1351,9 +1351,9 @@ are listed below.
13511351

13521352
Defaults to ``-fno-unsafe-math-optimizations``.
13531353

1354-
.. _opt_ffinite-math:
1354+
.. _opt_ffinite-math-only:
13551355

1356-
**-f[no-]finite-math**
1356+
**-f[no-]finite-math-only**
13571357

13581358
Allow floating-point optimizations that assume arguments and results are
13591359
not NaNs or +-Inf. This defines the ``__FINITE_MATH_ONLY__`` preprocessor macro.
@@ -1362,7 +1362,7 @@ are listed below.
13621362
* ``-fno-honor-infinities``
13631363
* ``-fno-honor-nans``
13641364

1365-
Defaults to ``-fno-finite-math``.
1365+
Defaults to ``-fno-finite-math-only``.
13661366

13671367
.. _opt_frounding-math:
13681368

clang/include/clang/AST/Expr.h

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,21 +2118,21 @@ class ParenExpr : public Expr {
21182118
///
21192119
class UnaryOperator final
21202120
: public Expr,
2121-
private llvm::TrailingObjects<UnaryOperator, FPOptions> {
2121+
private llvm::TrailingObjects<UnaryOperator, FPOptionsOverride> {
21222122
Stmt *Val;
21232123

2124-
size_t numTrailingObjects(OverloadToken<FPOptions>) const {
2124+
size_t numTrailingObjects(OverloadToken<FPOptionsOverride>) const {
21252125
return UnaryOperatorBits.HasFPFeatures ? 1 : 0;
21262126
}
21272127

2128-
FPOptions &getTrailingFPFeatures() {
2128+
FPOptionsOverride &getTrailingFPFeatures() {
21292129
assert(UnaryOperatorBits.HasFPFeatures);
2130-
return *getTrailingObjects<FPOptions>();
2130+
return *getTrailingObjects<FPOptionsOverride>();
21312131
}
21322132

2133-
const FPOptions &getTrailingFPFeatures() const {
2133+
const FPOptionsOverride &getTrailingFPFeatures() const {
21342134
assert(UnaryOperatorBits.HasFPFeatures);
2135-
return *getTrailingObjects<FPOptions>();
2135+
return *getTrailingObjects<FPOptionsOverride>();
21362136
}
21372137

21382138
public:
@@ -2141,7 +2141,7 @@ class UnaryOperator final
21412141
protected:
21422142
UnaryOperator(const ASTContext &Ctx, Expr *input, Opcode opc, QualType type,
21432143
ExprValueKind VK, ExprObjectKind OK, SourceLocation l,
2144-
bool CanOverflow, FPOptions FPFeatures);
2144+
bool CanOverflow, FPOptionsOverride FPFeatures);
21452145

21462146
/// Build an empty unary operator.
21472147
explicit UnaryOperator(bool HasFPFeatures, EmptyShell Empty)
@@ -2156,7 +2156,7 @@ class UnaryOperator final
21562156
static UnaryOperator *Create(const ASTContext &C, Expr *input, Opcode opc,
21572157
QualType type, ExprValueKind VK,
21582158
ExprObjectKind OK, SourceLocation l,
2159-
bool CanOverflow, FPOptions FPFeatures);
2159+
bool CanOverflow, FPOptionsOverride FPFeatures);
21602160

21612161
Opcode getOpcode() const {
21622162
return static_cast<Opcode>(UnaryOperatorBits.Opc);
@@ -2182,13 +2182,13 @@ class UnaryOperator final
21822182
// Get the FP contractability status of this operator. Only meaningful for
21832183
// operations on floating point types.
21842184
bool isFPContractableWithinStatement(const LangOptions &LO) const {
2185-
return getFPFeatures(LO).allowFPContractWithinStatement();
2185+
return getFPFeaturesInEffect(LO).allowFPContractWithinStatement();
21862186
}
21872187

21882188
// Get the FENV_ACCESS status of this operator. Only meaningful for
21892189
// operations on floating point types.
21902190
bool isFEnvAccessOn(const LangOptions &LO) const {
2191-
return getFPFeatures(LO).allowFEnvAccess();
2191+
return getFPFeaturesInEffect(LO).getAllowFEnvAccess();
21922192
}
21932193

21942194
/// isPostfix - Return true if this is a postfix operation, like x++.
@@ -2263,19 +2263,26 @@ class UnaryOperator final
22632263

22642264
protected:
22652265
/// Get FPFeatures from trailing storage
2266-
FPOptions getStoredFPFeatures() const { return getTrailingFPFeatures(); }
2266+
FPOptionsOverride getStoredFPFeatures() const {
2267+
return getTrailingFPFeatures();
2268+
}
22672269

22682270
/// Set FPFeatures in trailing storage, used only by Serialization
2269-
void setStoredFPFeatures(FPOptions F) { getTrailingFPFeatures() = F; }
2271+
void setStoredFPFeatures(FPOptionsOverride F) { getTrailingFPFeatures() = F; }
22702272

22712273
public:
22722274
// Get the FP features status of this operator. Only meaningful for
22732275
// operations on floating point types.
2274-
FPOptions getFPFeatures(const LangOptions &LO) const {
2276+
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const {
22752277
if (UnaryOperatorBits.HasFPFeatures)
2276-
return getStoredFPFeatures();
2278+
return getStoredFPFeatures().applyOverrides(LO);
22772279
return FPOptions::defaultWithoutTrailingStorage(LO);
22782280
}
2281+
FPOptionsOverride getFPOptionsOverride() const {
2282+
if (UnaryOperatorBits.HasFPFeatures)
2283+
return getStoredFPFeatures();
2284+
return FPOptionsOverride();
2285+
}
22792286

22802287
friend TrailingObjects;
22812288
friend class ASTReader;
@@ -3633,22 +3640,22 @@ class BinaryOperator : public Expr {
36333640
size_t offsetOfTrailingStorage() const;
36343641

36353642
/// Return a pointer to the trailing FPOptions
3636-
FPOptions *getTrailingFPFeatures() {
3643+
FPOptionsOverride *getTrailingFPFeatures() {
36373644
assert(BinaryOperatorBits.HasFPFeatures);
3638-
return reinterpret_cast<FPOptions *>(reinterpret_cast<char *>(this) +
3639-
offsetOfTrailingStorage());
3645+
return reinterpret_cast<FPOptionsOverride *>(
3646+
reinterpret_cast<char *>(this) + offsetOfTrailingStorage());
36403647
}
3641-
const FPOptions *getTrailingFPFeatures() const {
3648+
const FPOptionsOverride *getTrailingFPFeatures() const {
36423649
assert(BinaryOperatorBits.HasFPFeatures);
3643-
return reinterpret_cast<const FPOptions *>(
3650+
return reinterpret_cast<const FPOptionsOverride *>(
36443651
reinterpret_cast<const char *>(this) + offsetOfTrailingStorage());
36453652
}
36463653

36473654
/// Build a binary operator, assuming that appropriate storage has been
36483655
/// allocated for the trailing objects when needed.
36493656
BinaryOperator(const ASTContext &Ctx, Expr *lhs, Expr *rhs, Opcode opc,
36503657
QualType ResTy, ExprValueKind VK, ExprObjectKind OK,
3651-
SourceLocation opLoc, FPOptions FPFeatures);
3658+
SourceLocation opLoc, FPOptionsOverride FPFeatures);
36523659

36533660
/// Construct an empty binary operator.
36543661
explicit BinaryOperator(EmptyShell Empty) : Expr(BinaryOperatorClass, Empty) {
@@ -3661,7 +3668,7 @@ class BinaryOperator : public Expr {
36613668
static BinaryOperator *Create(const ASTContext &C, Expr *lhs, Expr *rhs,
36623669
Opcode opc, QualType ResTy, ExprValueKind VK,
36633670
ExprObjectKind OK, SourceLocation opLoc,
3664-
FPOptions FPFeatures);
3671+
FPOptionsOverride FPFeatures);
36653672
SourceLocation getExprLoc() const { return getOperatorLoc(); }
36663673
SourceLocation getOperatorLoc() const { return BinaryOperatorBits.OpLoc; }
36673674
void setOperatorLoc(SourceLocation L) { BinaryOperatorBits.OpLoc = L; }
@@ -3808,40 +3815,48 @@ class BinaryOperator : public Expr {
38083815
bool hasStoredFPFeatures() const { return BinaryOperatorBits.HasFPFeatures; }
38093816

38103817
/// Get FPFeatures from trailing storage
3811-
FPOptions getStoredFPFeatures() const {
3818+
FPOptionsOverride getStoredFPFeatures() const {
38123819
assert(hasStoredFPFeatures());
38133820
return *getTrailingFPFeatures();
38143821
}
38153822
/// Set FPFeatures in trailing storage, used only by Serialization
3816-
void setStoredFPFeatures(FPOptions F) {
3823+
void setStoredFPFeatures(FPOptionsOverride F) {
38173824
assert(BinaryOperatorBits.HasFPFeatures);
38183825
*getTrailingFPFeatures() = F;
38193826
}
38203827

38213828
// Get the FP features status of this operator. Only meaningful for
38223829
// operations on floating point types.
3823-
FPOptions getFPFeatures(const LangOptions &LO) const {
3830+
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const {
38243831
if (BinaryOperatorBits.HasFPFeatures)
3825-
return getStoredFPFeatures();
3832+
return getStoredFPFeatures().applyOverrides(LO);
38263833
return FPOptions::defaultWithoutTrailingStorage(LO);
38273834
}
38283835

3836+
// This is used in ASTImporter
3837+
FPOptionsOverride getFPFeatures(const LangOptions &LO) const {
3838+
if (BinaryOperatorBits.HasFPFeatures)
3839+
return getStoredFPFeatures();
3840+
return FPOptionsOverride();
3841+
}
3842+
38293843
// Get the FP contractability status of this operator. Only meaningful for
38303844
// operations on floating point types.
38313845
bool isFPContractableWithinStatement(const LangOptions &LO) const {
3832-
return getFPFeatures(LO).allowFPContractWithinStatement();
3846+
return getFPFeaturesInEffect(LO).allowFPContractWithinStatement();
38333847
}
38343848

38353849
// Get the FENV_ACCESS status of this operator. Only meaningful for
38363850
// operations on floating point types.
38373851
bool isFEnvAccessOn(const LangOptions &LO) const {
3838-
return getFPFeatures(LO).allowFEnvAccess();
3852+
return getFPFeaturesInEffect(LO).getAllowFEnvAccess();
38393853
}
38403854

38413855
protected:
38423856
BinaryOperator(const ASTContext &Ctx, Expr *lhs, Expr *rhs, Opcode opc,
38433857
QualType ResTy, ExprValueKind VK, ExprObjectKind OK,
3844-
SourceLocation opLoc, FPOptions FPFeatures, bool dead2);
3858+
SourceLocation opLoc, FPOptionsOverride FPFeatures,
3859+
bool dead2);
38453860

38463861
/// Construct an empty BinaryOperator, SC is CompoundAssignOperator.
38473862
BinaryOperator(StmtClass SC, EmptyShell Empty) : Expr(SC, Empty) {
@@ -3851,7 +3866,7 @@ class BinaryOperator : public Expr {
38513866
/// Return the size in bytes needed for the trailing objects.
38523867
/// Used to allocate the right amount of storage.
38533868
static unsigned sizeOfTrailingObjects(bool HasFPFeatures) {
3854-
return HasFPFeatures * sizeof(FPOptions);
3869+
return HasFPFeatures * sizeof(FPOptionsOverride);
38553870
}
38563871
};
38573872

@@ -3873,7 +3888,7 @@ class CompoundAssignOperator : public BinaryOperator {
38733888
protected:
38743889
CompoundAssignOperator(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc,
38753890
QualType ResType, ExprValueKind VK, ExprObjectKind OK,
3876-
SourceLocation OpLoc, FPOptions FPFeatures,
3891+
SourceLocation OpLoc, FPOptionsOverride FPFeatures,
38773892
QualType CompLHSType, QualType CompResultType)
38783893
: BinaryOperator(C, lhs, rhs, opc, ResType, VK, OK, OpLoc, FPFeatures,
38793894
true),
@@ -3889,7 +3904,7 @@ class CompoundAssignOperator : public BinaryOperator {
38893904
static CompoundAssignOperator *
38903905
Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy,
38913906
ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc,
3892-
FPOptions FPFeatures, QualType CompLHSType = QualType(),
3907+
FPOptionsOverride FPFeatures, QualType CompLHSType = QualType(),
38933908
QualType CompResultType = QualType());
38943909

38953910
// The two computation types are the type the LHS is converted

clang/include/clang/AST/ExprCXX.h

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class CXXOperatorCallExpr final : public CallExpr {
8484
friend class ASTStmtWriter;
8585

8686
SourceRange Range;
87+
FPOptionsOverride Overrides;
8788

8889
// CXXOperatorCallExpr has some trailing objects belonging
8990
// to CallExpr. See CallExpr for the details.
@@ -92,7 +93,7 @@ class CXXOperatorCallExpr final : public CallExpr {
9293

9394
CXXOperatorCallExpr(OverloadedOperatorKind OpKind, Expr *Fn,
9495
ArrayRef<Expr *> Args, QualType Ty, ExprValueKind VK,
95-
SourceLocation OperatorLoc, FPOptions FPFeatures,
96+
SourceLocation OperatorLoc, FPOptionsOverride FPFeatures,
9697
ADLCallKind UsesADL);
9798

9899
CXXOperatorCallExpr(unsigned NumArgs, EmptyShell Empty);
@@ -101,7 +102,7 @@ class CXXOperatorCallExpr final : public CallExpr {
101102
static CXXOperatorCallExpr *
102103
Create(const ASTContext &Ctx, OverloadedOperatorKind OpKind, Expr *Fn,
103104
ArrayRef<Expr *> Args, QualType Ty, ExprValueKind VK,
104-
SourceLocation OperatorLoc, FPOptions FPFeatures,
105+
SourceLocation OperatorLoc, FPOptionsOverride FPFeatures,
105106
ADLCallKind UsesADL = NotADL);
106107

107108
static CXXOperatorCallExpr *CreateEmpty(const ASTContext &Ctx,
@@ -164,20 +165,10 @@ class CXXOperatorCallExpr final : public CallExpr {
164165
return T->getStmtClass() == CXXOperatorCallExprClass;
165166
}
166167

167-
// Set the FP contractability status of this operator. Only meaningful for
168+
// Set the FPFeatures status of this operator. Only meaningful for
168169
// operations on floating point types.
169-
void setFPFeatures(FPOptions F) {
170-
CXXOperatorCallExprBits.FPFeatures = F.getAsOpaqueInt();
171-
}
172-
FPOptions getFPFeatures() const {
173-
return FPOptions(CXXOperatorCallExprBits.FPFeatures);
174-
}
175-
176-
// Get the FP contractability status of this operator. Only meaningful for
177-
// operations on floating point types.
178-
bool isFPContractableWithinStatement() const {
179-
return getFPFeatures().allowFPContractWithinStatement();
180-
}
170+
void setFPFeatures(FPOptionsOverride F) { Overrides = F; }
171+
FPOptionsOverride getFPFeatures() const { return Overrides; }
181172
};
182173

183174
/// Represents a call to a member function that

clang/include/clang/AST/Stmt.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,9 +614,6 @@ class alignas(void *) Stmt {
614614
/// The kind of this overloaded operator. One of the enumerator
615615
/// value of OverloadedOperatorKind.
616616
unsigned OperatorKind : 6;
617-
618-
// Only meaningful for floating point types.
619-
unsigned FPFeatures : 14;
620617
};
621618

622619
class CXXRewrittenBinaryOperatorBitfields {

clang/include/clang/Basic/Builtins.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
// & -> reference (optionally followed by an address space number)
6666
// C -> const
6767
// D -> volatile
68+
// R -> restrict
6869

6970
// The third value provided to the macro specifies information about attributes
7071
// of the function. These must be kept in sync with the predicates in the

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ BUILTIN(__builtin_amdgcn_trig_preop, "ddi", "nc")
7777
BUILTIN(__builtin_amdgcn_trig_preopf, "ffi", "nc")
7878
BUILTIN(__builtin_amdgcn_rcp, "dd", "nc")
7979
BUILTIN(__builtin_amdgcn_rcpf, "ff", "nc")
80+
BUILTIN(__builtin_amdgcn_sqrt, "dd", "nc")
81+
BUILTIN(__builtin_amdgcn_sqrtf, "ff", "nc")
8082
BUILTIN(__builtin_amdgcn_rsq, "dd", "nc")
8183
BUILTIN(__builtin_amdgcn_rsqf, "ff", "nc")
8284
BUILTIN(__builtin_amdgcn_rsq_clamp, "dd", "nc")
@@ -162,6 +164,7 @@ BUILTIN(__builtin_amdgcn_interp_mov, "fUiUiUiUi", "nc")
162164

163165
TARGET_BUILTIN(__builtin_amdgcn_div_fixuph, "hhhh", "nc", "16-bit-insts")
164166
TARGET_BUILTIN(__builtin_amdgcn_rcph, "hh", "nc", "16-bit-insts")
167+
TARGET_BUILTIN(__builtin_amdgcn_sqrth, "hh", "nc", "16-bit-insts")
165168
TARGET_BUILTIN(__builtin_amdgcn_rsqh, "hh", "nc", "16-bit-insts")
166169
TARGET_BUILTIN(__builtin_amdgcn_sinh, "hh", "nc", "16-bit-insts")
167170
TARGET_BUILTIN(__builtin_amdgcn_cosh, "hh", "nc", "16-bit-insts")
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//===--- FPOptions.def - Floating Point Options database --------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// This file defines the Floating Point language options. Users of this file
10+
// must define the FPOPT macro to make use of this information.
11+
#ifndef OPTION
12+
# error Define the OPTION macro to handle floating point language options
13+
#endif
14+
15+
// OPTION(name, type, width, previousName)
16+
OPTION(FPContractMode, LangOptions::FPModeKind, 2, First)
17+
OPTION(RoundingMode, RoundingMode, 3, FPContractMode)
18+
OPTION(FPExceptionMode, LangOptions::FPExceptionModeKind, 2, RoundingMode)
19+
OPTION(AllowFEnvAccess, bool, 1, FPExceptionMode)
20+
OPTION(AllowFPReassociate, bool, 1, AllowFEnvAccess)
21+
OPTION(NoHonorNaNs, bool, 1, AllowFPReassociate)
22+
OPTION(NoHonorInfs, bool, 1, NoHonorNaNs)
23+
OPTION(NoSignedZero, bool, 1, NoHonorInfs)
24+
OPTION(AllowReciprocal, bool, 1, NoSignedZero)
25+
OPTION(AllowApproxFunc, bool, 1, AllowReciprocal)
26+
#undef OPTION

0 commit comments

Comments
 (0)