Skip to content

Commit ea77a04

Browse files
author
Artem Gindinson
committed
Merge from 'master' to 'sycl-web' (#89)
2 parents 0b295a1 + f1cd659 commit ea77a04

File tree

262 files changed

+9234
-7022
lines changed

Some content is hidden

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

262 files changed

+9234
-7022
lines changed

clang/docs/CommandGuide/clang.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,12 @@ number of cross compilers, or may only support a native target.
338338
.. option:: --print-supported-cpus
339339

340340
Print out a list of supported processors for the given target (specified
341-
through --target=<architecture> or -arch <architecture>). If no target is
342-
specified, the system default target will be used.
341+
through ``--target=<architecture>`` or :option:`-arch` ``<architecture>``). If no
342+
target is specified, the system default target will be used.
343343

344344
.. option:: -mcpu=?, -mtune=?
345345

346-
Aliases of --print-supported-cpus
346+
Acts as an alias for :option:`--print-supported-cpus`.
347347

348348
.. option:: -march=<cpu>
349349

clang/include/clang/AST/ASTStructuralEquivalence.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ struct StructuralEquivalenceContext {
9797
/// \c VisitedDecls members) and can cause faulty equivalent results.
9898
bool IsEquivalent(QualType T1, QualType T2);
9999

100+
/// Determine whether the two statements are structurally equivalent.
101+
/// Implementation functions (all static functions in
102+
/// ASTStructuralEquivalence.cpp) must never call this function because that
103+
/// will wreak havoc the internal state (\c DeclsToCheck and
104+
/// \c VisitedDecls members) and can cause faulty equivalent results.
105+
bool IsEquivalent(Stmt *S1, Stmt *S2);
106+
100107
/// Find the index of the given anonymous struct/union within its
101108
/// context.
102109
///

clang/include/clang/AST/Expr.h

Lines changed: 88 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3440,9 +3440,11 @@ class CastExpr : public Expr {
34403440
}
34413441
CXXBaseSpecifier **path_buffer();
34423442

3443+
friend class ASTStmtReader;
3444+
34433445
protected:
34443446
CastExpr(StmtClass SC, QualType ty, ExprValueKind VK, const CastKind kind,
3445-
Expr *op, unsigned BasePathSize)
3447+
Expr *op, unsigned BasePathSize, bool HasFPFeatures)
34463448
: Expr(SC, ty, VK, OK_Ordinary), Op(op) {
34473449
CastExprBits.Kind = kind;
34483450
CastExprBits.PartOfExplicitCast = false;
@@ -3451,17 +3453,27 @@ class CastExpr : public Expr {
34513453
"BasePathSize overflow!");
34523454
setDependence(computeDependence(this));
34533455
assert(CastConsistency());
3456+
CastExprBits.HasFPFeatures = HasFPFeatures;
34543457
}
34553458

34563459
/// Construct an empty cast.
3457-
CastExpr(StmtClass SC, EmptyShell Empty, unsigned BasePathSize)
3458-
: Expr(SC, Empty) {
3460+
CastExpr(StmtClass SC, EmptyShell Empty, unsigned BasePathSize,
3461+
bool HasFPFeatures)
3462+
: Expr(SC, Empty) {
34593463
CastExprBits.PartOfExplicitCast = false;
34603464
CastExprBits.BasePathSize = BasePathSize;
3465+
CastExprBits.HasFPFeatures = HasFPFeatures;
34613466
assert((CastExprBits.BasePathSize == BasePathSize) &&
34623467
"BasePathSize overflow!");
34633468
}
34643469

3470+
/// Return a pointer to the trailing FPOptions.
3471+
/// \pre hasStoredFPFeatures() == true
3472+
FPOptionsOverride *getTrailingFPFeatures();
3473+
const FPOptionsOverride *getTrailingFPFeatures() const {
3474+
return const_cast<CastExpr *>(this)->getTrailingFPFeatures();
3475+
}
3476+
34653477
public:
34663478
CastKind getCastKind() const { return (CastKind) CastExprBits.Kind; }
34673479
void setCastKind(CastKind K) { CastExprBits.Kind = K; }
@@ -3506,6 +3518,28 @@ class CastExpr : public Expr {
35063518
return getTargetFieldForToUnionCast(getType(), getSubExpr()->getType());
35073519
}
35083520

3521+
bool hasStoredFPFeatures() const { return CastExprBits.HasFPFeatures; }
3522+
3523+
/// Get FPOptionsOverride from trailing storage.
3524+
FPOptionsOverride getStoredFPFeatures() const {
3525+
assert(hasStoredFPFeatures());
3526+
return *getTrailingFPFeatures();
3527+
}
3528+
3529+
// Get the FP features status of this operation. Only meaningful for
3530+
// operations on floating point types.
3531+
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const {
3532+
if (hasStoredFPFeatures())
3533+
return getStoredFPFeatures().applyOverrides(LO);
3534+
return FPOptions::defaultWithoutTrailingStorage(LO);
3535+
}
3536+
3537+
FPOptionsOverride getFPFeatures() const {
3538+
if (hasStoredFPFeatures())
3539+
return getStoredFPFeatures();
3540+
return FPOptionsOverride();
3541+
}
3542+
35093543
static const FieldDecl *getTargetFieldForToUnionCast(QualType unionType,
35103544
QualType opType);
35113545
static const FieldDecl *getTargetFieldForToUnionCast(const RecordDecl *RD,
@@ -3543,21 +3577,35 @@ class CastExpr : public Expr {
35433577
/// @endcode
35443578
class ImplicitCastExpr final
35453579
: public CastExpr,
3546-
private llvm::TrailingObjects<ImplicitCastExpr, CXXBaseSpecifier *> {
3580+
private llvm::TrailingObjects<ImplicitCastExpr, CXXBaseSpecifier *,
3581+
FPOptionsOverride> {
35473582

35483583
ImplicitCastExpr(QualType ty, CastKind kind, Expr *op,
3549-
unsigned BasePathLength, ExprValueKind VK)
3550-
: CastExpr(ImplicitCastExprClass, ty, VK, kind, op, BasePathLength) { }
3584+
unsigned BasePathLength, FPOptionsOverride FPO,
3585+
ExprValueKind VK)
3586+
: CastExpr(ImplicitCastExprClass, ty, VK, kind, op, BasePathLength,
3587+
FPO.requiresTrailingStorage()) {
3588+
if (hasStoredFPFeatures())
3589+
*getTrailingFPFeatures() = FPO;
3590+
}
35513591

35523592
/// Construct an empty implicit cast.
3553-
explicit ImplicitCastExpr(EmptyShell Shell, unsigned PathSize)
3554-
: CastExpr(ImplicitCastExprClass, Shell, PathSize) { }
3593+
explicit ImplicitCastExpr(EmptyShell Shell, unsigned PathSize,
3594+
bool HasFPFeatures)
3595+
: CastExpr(ImplicitCastExprClass, Shell, PathSize, HasFPFeatures) {}
3596+
3597+
unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>) const {
3598+
return path_size();
3599+
}
35553600

35563601
public:
35573602
enum OnStack_t { OnStack };
35583603
ImplicitCastExpr(OnStack_t _, QualType ty, CastKind kind, Expr *op,
3559-
ExprValueKind VK)
3560-
: CastExpr(ImplicitCastExprClass, ty, VK, kind, op, 0) {
3604+
ExprValueKind VK, FPOptionsOverride FPO)
3605+
: CastExpr(ImplicitCastExprClass, ty, VK, kind, op, 0,
3606+
FPO.requiresTrailingStorage()) {
3607+
if (hasStoredFPFeatures())
3608+
*getTrailingFPFeatures() = FPO;
35613609
}
35623610

35633611
bool isPartOfExplicitCast() const { return CastExprBits.PartOfExplicitCast; }
@@ -3568,10 +3616,10 @@ class ImplicitCastExpr final
35683616
static ImplicitCastExpr *Create(const ASTContext &Context, QualType T,
35693617
CastKind Kind, Expr *Operand,
35703618
const CXXCastPath *BasePath,
3571-
ExprValueKind Cat);
3619+
ExprValueKind Cat, FPOptionsOverride FPO);
35723620

35733621
static ImplicitCastExpr *CreateEmpty(const ASTContext &Context,
3574-
unsigned PathSize);
3622+
unsigned PathSize, bool HasFPFeatures);
35753623

35763624
SourceLocation getBeginLoc() const LLVM_READONLY {
35773625
return getSubExpr()->getBeginLoc();
@@ -3612,12 +3660,14 @@ class ExplicitCastExpr : public CastExpr {
36123660
protected:
36133661
ExplicitCastExpr(StmtClass SC, QualType exprTy, ExprValueKind VK,
36143662
CastKind kind, Expr *op, unsigned PathSize,
3615-
TypeSourceInfo *writtenTy)
3616-
: CastExpr(SC, exprTy, VK, kind, op, PathSize), TInfo(writtenTy) {}
3663+
bool HasFPFeatures, TypeSourceInfo *writtenTy)
3664+
: CastExpr(SC, exprTy, VK, kind, op, PathSize, HasFPFeatures),
3665+
TInfo(writtenTy) {}
36173666

36183667
/// Construct an empty explicit cast.
3619-
ExplicitCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize)
3620-
: CastExpr(SC, Shell, PathSize) { }
3668+
ExplicitCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize,
3669+
bool HasFPFeatures)
3670+
: CastExpr(SC, Shell, PathSize, HasFPFeatures) {}
36213671

36223672
public:
36233673
/// getTypeInfoAsWritten - Returns the type source info for the type
@@ -3640,29 +3690,38 @@ class ExplicitCastExpr : public CastExpr {
36403690
/// (Type)expr. For example: @c (int)f.
36413691
class CStyleCastExpr final
36423692
: public ExplicitCastExpr,
3643-
private llvm::TrailingObjects<CStyleCastExpr, CXXBaseSpecifier *> {
3693+
private llvm::TrailingObjects<CStyleCastExpr, CXXBaseSpecifier *,
3694+
FPOptionsOverride> {
36443695
SourceLocation LPLoc; // the location of the left paren
36453696
SourceLocation RPLoc; // the location of the right paren
36463697

36473698
CStyleCastExpr(QualType exprTy, ExprValueKind vk, CastKind kind, Expr *op,
3648-
unsigned PathSize, TypeSourceInfo *writtenTy,
3649-
SourceLocation l, SourceLocation r)
3650-
: ExplicitCastExpr(CStyleCastExprClass, exprTy, vk, kind, op, PathSize,
3651-
writtenTy), LPLoc(l), RPLoc(r) {}
3699+
unsigned PathSize, FPOptionsOverride FPO,
3700+
TypeSourceInfo *writtenTy, SourceLocation l, SourceLocation r)
3701+
: ExplicitCastExpr(CStyleCastExprClass, exprTy, vk, kind, op, PathSize,
3702+
FPO.requiresTrailingStorage(), writtenTy),
3703+
LPLoc(l), RPLoc(r) {
3704+
if (hasStoredFPFeatures())
3705+
*getTrailingFPFeatures() = FPO;
3706+
}
36523707

36533708
/// Construct an empty C-style explicit cast.
3654-
explicit CStyleCastExpr(EmptyShell Shell, unsigned PathSize)
3655-
: ExplicitCastExpr(CStyleCastExprClass, Shell, PathSize) { }
3709+
explicit CStyleCastExpr(EmptyShell Shell, unsigned PathSize,
3710+
bool HasFPFeatures)
3711+
: ExplicitCastExpr(CStyleCastExprClass, Shell, PathSize, HasFPFeatures) {}
3712+
3713+
unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>) const {
3714+
return path_size();
3715+
}
36563716

36573717
public:
3658-
static CStyleCastExpr *Create(const ASTContext &Context, QualType T,
3659-
ExprValueKind VK, CastKind K,
3660-
Expr *Op, const CXXCastPath *BasePath,
3661-
TypeSourceInfo *WrittenTy, SourceLocation L,
3662-
SourceLocation R);
3718+
static CStyleCastExpr *
3719+
Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K,
3720+
Expr *Op, const CXXCastPath *BasePath, FPOptionsOverride FPO,
3721+
TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation R);
36633722

36643723
static CStyleCastExpr *CreateEmpty(const ASTContext &Context,
3665-
unsigned PathSize);
3724+
unsigned PathSize, bool HasFPFeatures);
36663725

36673726
SourceLocation getLParenLoc() const { return LPLoc; }
36683727
void setLParenLoc(SourceLocation L) { LPLoc = L; }

0 commit comments

Comments
 (0)