Skip to content

Commit

Permalink
Merged master:4ede83c06831 into amd-gfx:9b09fedad35c
Browse files Browse the repository at this point in the history
Local branch amd-gfx 9b09fed Merged master:b3f364e8561c into amd-gfx:c465085fd962
Remote branch master 4ede83c [gn build] Port 19531a8
  • Loading branch information
Sw authored and Sw committed Sep 12, 2020
2 parents 9b09fed + 4ede83c commit eba5b48
Show file tree
Hide file tree
Showing 35 changed files with 254 additions and 461 deletions.
117 changes: 29 additions & 88 deletions clang/include/clang/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -3440,11 +3440,9 @@ class CastExpr : public Expr {
}
CXXBaseSpecifier **path_buffer();

friend class ASTStmtReader;

protected:
CastExpr(StmtClass SC, QualType ty, ExprValueKind VK, const CastKind kind,
Expr *op, unsigned BasePathSize, bool HasFPFeatures)
Expr *op, unsigned BasePathSize)
: Expr(SC, ty, VK, OK_Ordinary), Op(op) {
CastExprBits.Kind = kind;
CastExprBits.PartOfExplicitCast = false;
Expand All @@ -3453,27 +3451,17 @@ class CastExpr : public Expr {
"BasePathSize overflow!");
setDependence(computeDependence(this));
assert(CastConsistency());
CastExprBits.HasFPFeatures = HasFPFeatures;
}

/// Construct an empty cast.
CastExpr(StmtClass SC, EmptyShell Empty, unsigned BasePathSize,
bool HasFPFeatures)
: Expr(SC, Empty) {
CastExpr(StmtClass SC, EmptyShell Empty, unsigned BasePathSize)
: Expr(SC, Empty) {
CastExprBits.PartOfExplicitCast = false;
CastExprBits.BasePathSize = BasePathSize;
CastExprBits.HasFPFeatures = HasFPFeatures;
assert((CastExprBits.BasePathSize == BasePathSize) &&
"BasePathSize overflow!");
}

/// Return a pointer to the trailing FPOptions.
/// \pre hasStoredFPFeatures() == true
FPOptionsOverride *getTrailingFPFeatures();
const FPOptionsOverride *getTrailingFPFeatures() const {
return const_cast<CastExpr *>(this)->getTrailingFPFeatures();
}

public:
CastKind getCastKind() const { return (CastKind) CastExprBits.Kind; }
void setCastKind(CastKind K) { CastExprBits.Kind = K; }
Expand Down Expand Up @@ -3518,28 +3506,6 @@ class CastExpr : public Expr {
return getTargetFieldForToUnionCast(getType(), getSubExpr()->getType());
}

bool hasStoredFPFeatures() const { return CastExprBits.HasFPFeatures; }

/// Get FPOptionsOverride from trailing storage.
FPOptionsOverride getStoredFPFeatures() const {
assert(hasStoredFPFeatures());
return *getTrailingFPFeatures();
}

// Get the FP features status of this operation. Only meaningful for
// operations on floating point types.
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const {
if (hasStoredFPFeatures())
return getStoredFPFeatures().applyOverrides(LO);
return FPOptions::defaultWithoutTrailingStorage(LO);
}

FPOptionsOverride getFPFeatures() const {
if (hasStoredFPFeatures())
return getStoredFPFeatures();
return FPOptionsOverride();
}

static const FieldDecl *getTargetFieldForToUnionCast(QualType unionType,
QualType opType);
static const FieldDecl *getTargetFieldForToUnionCast(const RecordDecl *RD,
Expand Down Expand Up @@ -3577,35 +3543,21 @@ class CastExpr : public Expr {
/// @endcode
class ImplicitCastExpr final
: public CastExpr,
private llvm::TrailingObjects<ImplicitCastExpr, CXXBaseSpecifier *,
FPOptionsOverride> {
private llvm::TrailingObjects<ImplicitCastExpr, CXXBaseSpecifier *> {

ImplicitCastExpr(QualType ty, CastKind kind, Expr *op,
unsigned BasePathLength, FPOptionsOverride FPO,
ExprValueKind VK)
: CastExpr(ImplicitCastExprClass, ty, VK, kind, op, BasePathLength,
FPO.requiresTrailingStorage()) {
if (hasStoredFPFeatures())
*getTrailingFPFeatures() = FPO;
}
unsigned BasePathLength, ExprValueKind VK)
: CastExpr(ImplicitCastExprClass, ty, VK, kind, op, BasePathLength) { }

/// Construct an empty implicit cast.
explicit ImplicitCastExpr(EmptyShell Shell, unsigned PathSize,
bool HasFPFeatures)
: CastExpr(ImplicitCastExprClass, Shell, PathSize, HasFPFeatures) {}

unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>) const {
return path_size();
}
explicit ImplicitCastExpr(EmptyShell Shell, unsigned PathSize)
: CastExpr(ImplicitCastExprClass, Shell, PathSize) { }

public:
enum OnStack_t { OnStack };
ImplicitCastExpr(OnStack_t _, QualType ty, CastKind kind, Expr *op,
ExprValueKind VK, FPOptionsOverride FPO)
: CastExpr(ImplicitCastExprClass, ty, VK, kind, op, 0,
FPO.requiresTrailingStorage()) {
if (hasStoredFPFeatures())
*getTrailingFPFeatures() = FPO;
ExprValueKind VK)
: CastExpr(ImplicitCastExprClass, ty, VK, kind, op, 0) {
}

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

static ImplicitCastExpr *CreateEmpty(const ASTContext &Context,
unsigned PathSize, bool HasFPFeatures);
unsigned PathSize);

SourceLocation getBeginLoc() const LLVM_READONLY {
return getSubExpr()->getBeginLoc();
Expand Down Expand Up @@ -3660,14 +3612,12 @@ class ExplicitCastExpr : public CastExpr {
protected:
ExplicitCastExpr(StmtClass SC, QualType exprTy, ExprValueKind VK,
CastKind kind, Expr *op, unsigned PathSize,
bool HasFPFeatures, TypeSourceInfo *writtenTy)
: CastExpr(SC, exprTy, VK, kind, op, PathSize, HasFPFeatures),
TInfo(writtenTy) {}
TypeSourceInfo *writtenTy)
: CastExpr(SC, exprTy, VK, kind, op, PathSize), TInfo(writtenTy) {}

/// Construct an empty explicit cast.
ExplicitCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize,
bool HasFPFeatures)
: CastExpr(SC, Shell, PathSize, HasFPFeatures) {}
ExplicitCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize)
: CastExpr(SC, Shell, PathSize) { }

public:
/// getTypeInfoAsWritten - Returns the type source info for the type
Expand All @@ -3690,38 +3640,29 @@ class ExplicitCastExpr : public CastExpr {
/// (Type)expr. For example: @c (int)f.
class CStyleCastExpr final
: public ExplicitCastExpr,
private llvm::TrailingObjects<CStyleCastExpr, CXXBaseSpecifier *,
FPOptionsOverride> {
private llvm::TrailingObjects<CStyleCastExpr, CXXBaseSpecifier *> {
SourceLocation LPLoc; // the location of the left paren
SourceLocation RPLoc; // the location of the right paren

CStyleCastExpr(QualType exprTy, ExprValueKind vk, CastKind kind, Expr *op,
unsigned PathSize, FPOptionsOverride FPO,
TypeSourceInfo *writtenTy, SourceLocation l, SourceLocation r)
: ExplicitCastExpr(CStyleCastExprClass, exprTy, vk, kind, op, PathSize,
FPO.requiresTrailingStorage(), writtenTy),
LPLoc(l), RPLoc(r) {
if (hasStoredFPFeatures())
*getTrailingFPFeatures() = FPO;
}
unsigned PathSize, TypeSourceInfo *writtenTy,
SourceLocation l, SourceLocation r)
: ExplicitCastExpr(CStyleCastExprClass, exprTy, vk, kind, op, PathSize,
writtenTy), LPLoc(l), RPLoc(r) {}

/// Construct an empty C-style explicit cast.
explicit CStyleCastExpr(EmptyShell Shell, unsigned PathSize,
bool HasFPFeatures)
: ExplicitCastExpr(CStyleCastExprClass, Shell, PathSize, HasFPFeatures) {}

unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>) const {
return path_size();
}
explicit CStyleCastExpr(EmptyShell Shell, unsigned PathSize)
: ExplicitCastExpr(CStyleCastExprClass, Shell, PathSize) { }

public:
static CStyleCastExpr *
Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K,
Expr *Op, const CXXCastPath *BasePath, FPOptionsOverride FPO,
TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation R);
static CStyleCastExpr *Create(const ASTContext &Context, QualType T,
ExprValueKind VK, CastKind K,
Expr *Op, const CXXCastPath *BasePath,
TypeSourceInfo *WrittenTy, SourceLocation L,
SourceLocation R);

static CStyleCastExpr *CreateEmpty(const ASTContext &Context,
unsigned PathSize, bool HasFPFeatures);
unsigned PathSize);

SourceLocation getLParenLoc() const { return LPLoc; }
void setLParenLoc(SourceLocation L) { LPLoc = L; }
Expand Down
Loading

0 comments on commit eba5b48

Please sign in to comment.