Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 88 additions & 50 deletions clang/include/clang/AST/ExprCXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,10 @@ class CXXDynamicCastExpr final
friend class CastExpr;
friend TrailingObjects;

static CXXDynamicCastExpr *Create(const ASTContext &Context, QualType T,
ExprValueKind VK, CastKind Kind, Expr *Op,
const CXXCastPath *Path,
TypeSourceInfo *Written, SourceLocation L,
SourceLocation RParenLoc,
SourceRange AngleBrackets);
static CXXDynamicCastExpr *
Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind,
Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written,
SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets);

static CXXDynamicCastExpr *CreateEmpty(const ASTContext &Context,
unsigned pathSize);
Expand Down Expand Up @@ -540,12 +538,10 @@ class CXXReinterpretCastExpr final
friend class CastExpr;
friend TrailingObjects;

static CXXReinterpretCastExpr *Create(const ASTContext &Context, QualType T,
ExprValueKind VK, CastKind Kind,
Expr *Op, const CXXCastPath *Path,
TypeSourceInfo *WrittenTy, SourceLocation L,
SourceLocation RParenLoc,
SourceRange AngleBrackets);
static CXXReinterpretCastExpr *
Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind,
Expr *Op, const CXXCastPath *Path, TypeSourceInfo *WrittenTy,
SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets);
static CXXReinterpretCastExpr *CreateEmpty(const ASTContext &Context,
unsigned pathSize);

Expand Down Expand Up @@ -694,7 +690,7 @@ class UserDefinedLiteral final : public CallExpr {
/// removed).
Expr *getCookedLiteral();
const Expr *getCookedLiteral() const {
return const_cast<UserDefinedLiteral*>(this)->getCookedLiteral();
return const_cast<UserDefinedLiteral *>(this)->getCookedLiteral();
}

SourceLocation getBeginLoc() const {
Expand Down Expand Up @@ -813,8 +809,8 @@ class CXXStdInitializerListExpr : public Expr {
setDependence(computeDependence(this));
}

Expr *getSubExpr() { return static_cast<Expr*>(SubExpr); }
const Expr *getSubExpr() const { return static_cast<const Expr*>(SubExpr); }
Expr *getSubExpr() { return static_cast<Expr *>(SubExpr); }
const Expr *getSubExpr() const { return static_cast<const Expr *>(SubExpr); }

SourceLocation getBeginLoc() const LLVM_READONLY {
return SubExpr->getBeginLoc();
Expand Down Expand Up @@ -868,9 +864,9 @@ class CXXTypeidExpr : public Expr {
CXXTypeidExpr(EmptyShell Empty, bool isExpr)
: Expr(CXXTypeidExprClass, Empty) {
if (isExpr)
Operand = (Expr*)nullptr;
Operand = (Expr *)nullptr;
else
Operand = (TypeSourceInfo*)nullptr;
Operand = (TypeSourceInfo *)nullptr;
}

/// Determine whether this typeid has a type operand which is potentially
Expand Down Expand Up @@ -968,13 +964,13 @@ class MSPropertyRefExpr : public Expr {
else if (QualifierLoc)
return QualifierLoc.getBeginLoc();
else
return MemberLoc;
return MemberLoc;
}

SourceLocation getEndLoc() const { return getMemberLoc(); }

child_range children() {
return child_range((Stmt**)&BaseExpr, (Stmt**)&BaseExpr + 1);
return child_range((Stmt **)&BaseExpr, (Stmt **)&BaseExpr + 1);
}

const_child_range children() const {
Expand Down Expand Up @@ -1089,11 +1085,11 @@ class CXXUuidofExpr : public Expr {
}

CXXUuidofExpr(EmptyShell Empty, bool isExpr)
: Expr(CXXUuidofExprClass, Empty) {
: Expr(CXXUuidofExprClass, Empty) {
if (isExpr)
Operand = (Expr*)nullptr;
Operand = (Expr *)nullptr;
else
Operand = (TypeSourceInfo*)nullptr;
Operand = (TypeSourceInfo *)nullptr;
}

bool isTypeOperand() const { return isa<TypeSourceInfo *>(Operand); }
Expand Down Expand Up @@ -1470,9 +1466,7 @@ class CXXTemporary {

const CXXDestructorDecl *getDestructor() const { return Destructor; }

void setDestructor(const CXXDestructorDecl *Dtor) {
Destructor = Dtor;
}
void setDestructor(const CXXDestructorDecl *Dtor) { Destructor = Dtor; }
};

/// Represents binding an expression to a temporary.
Expand Down Expand Up @@ -1507,7 +1501,7 @@ class CXXBindTemporaryExpr : public Expr {
: Expr(CXXBindTemporaryExprClass, Empty) {}

static CXXBindTemporaryExpr *Create(const ASTContext &C, CXXTemporary *Temp,
Expr* SubExpr);
Expr *SubExpr);

CXXTemporary *getTemporary() { return Temp; }
const CXXTemporary *getTemporary() const { return Temp; }
Expand Down Expand Up @@ -2214,9 +2208,7 @@ class CXXScalarValueInitExpr : public Expr {
explicit CXXScalarValueInitExpr(EmptyShell Shell)
: Expr(CXXScalarValueInitExprClass, Shell) {}

TypeSourceInfo *getTypeSourceInfo() const {
return TypeInfo;
}
TypeSourceInfo *getTypeSourceInfo() const { return TypeInfo; }

SourceLocation getRParenLoc() const {
return CXXScalarValueInitExprBits.RParenLoc;
Expand Down Expand Up @@ -2777,12 +2769,11 @@ class CXXPseudoDestructorExpr : public Expr {
PseudoDestructorTypeStorage DestroyedType;

public:
CXXPseudoDestructorExpr(const ASTContext &Context,
Expr *Base, bool isArrow, SourceLocation OperatorLoc,
CXXPseudoDestructorExpr(const ASTContext &Context, Expr *Base, bool isArrow,
SourceLocation OperatorLoc,
NestedNameSpecifierLoc QualifierLoc,
TypeSourceInfo *ScopeType,
SourceLocation ColonColonLoc,
SourceLocation TildeLoc,
SourceLocation ColonColonLoc, SourceLocation TildeLoc,
PseudoDestructorTypeStorage DestroyedType);

explicit CXXPseudoDestructorExpr(EmptyShell Shell)
Expand Down Expand Up @@ -2925,8 +2916,7 @@ class TypeTraitExpr final
static TypeTraitExpr *Create(const ASTContext &C, QualType T,
SourceLocation Loc, TypeTrait Kind,
ArrayRef<TypeSourceInfo *> Args,
SourceLocation RParenLoc,
bool Value);
SourceLocation RParenLoc, bool Value);

static TypeTraitExpr *Create(const ASTContext &C, QualType T,
SourceLocation Loc, TypeTrait Kind,
Expand Down Expand Up @@ -3043,7 +3033,10 @@ class ArrayTypeTraitExpr : public Expr {

TypeSourceInfo *getQueriedTypeSourceInfo() const { return QueriedType; }

uint64_t getValue() const { assert(!isTypeDependent()); return Value; }
uint64_t getValue() const {
assert(!isTypeDependent());
return Value;
}

Expr *getDimensionExpression() const { return Dimension; }

Expand Down Expand Up @@ -3076,7 +3069,7 @@ class ExpressionTraitExpr : public Expr {
SourceLocation RParen;

/// The expression being queried.
Expr* QueriedExpression = nullptr;
Expr *QueriedExpression = nullptr;

public:
friend class ASTStmtReader;
Expand Down Expand Up @@ -3810,7 +3803,7 @@ class CXXUnresolvedConstructExpr final
arg_iterator arg_end() { return arg_begin() + getNumArgs(); }
arg_range arguments() { return arg_range(arg_begin(), arg_end()); }

using const_arg_iterator = const Expr* const *;
using const_arg_iterator = const Expr *const *;
using const_arg_range = llvm::iterator_range<const_arg_iterator>;

const_arg_iterator arg_begin() const { return getTrailingObjects(); }
Expand Down Expand Up @@ -4420,9 +4413,7 @@ class PackExpansionExpr : public Expr {
}

// Iterators
child_range children() {
return child_range(&Pattern, &Pattern + 1);
}
child_range children() { return child_range(&Pattern, &Pattern + 1); }

const_child_range children() const {
return const_child_range(&Pattern, &Pattern + 1);
Expand Down Expand Up @@ -4525,9 +4516,7 @@ class SizeOfPackExpr final
///
/// template<typename ...Ts> using X = int[sizeof...(Ts)];
/// template<typename ...Us> void f(X<Us..., 1, 2, 3, Us...>);
bool isPartiallySubstituted() const {
return isValueDependent() && Length;
}
bool isPartiallySubstituted() const { return isValueDependent() && Length; }

/// Get
ArrayRef<TemplateArgument> getPartialArguments() const {
Expand Down Expand Up @@ -5056,8 +5045,8 @@ class CXXFoldExpr : public Expr {
UnresolvedLookupExpr *getCallee() const {
return static_cast<UnresolvedLookupExpr *>(SubExprs[SubExpr::Callee]);
}
Expr *getLHS() const { return static_cast<Expr*>(SubExprs[SubExpr::LHS]); }
Expr *getRHS() const { return static_cast<Expr*>(SubExprs[SubExpr::RHS]); }
Expr *getLHS() const { return static_cast<Expr *>(SubExprs[SubExpr::LHS]); }
Expr *getRHS() const { return static_cast<Expr *>(SubExprs[SubExpr::RHS]); }

/// Does this produce a right-associated sequence of operators?
bool isRightFold() const {
Expand Down Expand Up @@ -5304,22 +5293,22 @@ class CoroutineSuspendExpr : public Expr {
}

Expr *getCommonExpr() const {
return static_cast<Expr*>(SubExprs[SubExpr::Common]);
return static_cast<Expr *>(SubExprs[SubExpr::Common]);
}

/// getOpaqueValue - Return the opaque value placeholder.
OpaqueValueExpr *getOpaqueValue() const { return OpaqueValue; }

Expr *getReadyExpr() const {
return static_cast<Expr*>(SubExprs[SubExpr::Ready]);
return static_cast<Expr *>(SubExprs[SubExpr::Ready]);
}

Expr *getSuspendExpr() const {
return static_cast<Expr*>(SubExprs[SubExpr::Suspend]);
return static_cast<Expr *>(SubExprs[SubExpr::Suspend]);
}

Expr *getResumeExpr() const {
return static_cast<Expr*>(SubExprs[SubExpr::Resume]);
return static_cast<Expr *>(SubExprs[SubExpr::Resume]);
}

// The syntactic operand written in the code
Expand Down Expand Up @@ -5501,6 +5490,55 @@ class BuiltinBitCastExpr final
}
};

/// Represents a C++2c reflect expression (P2996).
class CXXReflectExpr : public Expr {

// Source locations.
SourceLocation OperatorLoc;
SourceRange OperandRange;

CXXReflectExpr(const ASTContext &C, QualType T, QualType Ty);
CXXReflectExpr(const ASTContext &C, QualType T, Decl *Arg, bool IsNamespace);
CXXReflectExpr(EmptyShell Empty);

public:
static CXXReflectExpr *Create(ASTContext &C, SourceLocation OperatorLoc,
SourceLocation ArgLoc, QualType Operand);

static CXXReflectExpr *Create(ASTContext &C, SourceLocation OperatorLoc,
SourceLocation OperandLoc, Decl *Operand);

static CXXReflectExpr *CreateEmpty(ASTContext &C);

SourceLocation getBeginLoc() const LLVM_READONLY { return OperatorLoc; }
SourceLocation getEndLoc() const LLVM_READONLY {
return OperandRange.getEnd();
}
SourceRange getSourceRange() const {
return SourceRange(getBeginLoc(), getEndLoc());
}

/// Returns location of the '^^'-operator.
SourceLocation getOperatorLoc() const { return OperatorLoc; }
SourceRange getOperandRange() const { return OperandRange; }

/// Sets the location of the '^^'-operator.
void setOperatorLoc(SourceLocation L) { OperatorLoc = L; }
void setOperandRange(SourceRange R) { OperandRange = R; }

child_range children() {
return child_range(child_iterator(), child_iterator());
}

const_child_range children() const {
return const_child_range(const_child_iterator(), const_child_iterator());
}

static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXReflectExprClass;
}
};

} // namespace clang

#endif // LLVM_CLANG_AST_EXPRCXX_H
Loading
Loading