summaryrefslogtreecommitdiff
path: root/include/clang/AST/ExprCXX.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/AST/ExprCXX.h')
-rw-r--r--include/clang/AST/ExprCXX.h79
1 files changed, 52 insertions, 27 deletions
diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h
index 8206a26b2c4b5..7ab8020dec649 100644
--- a/include/clang/AST/ExprCXX.h
+++ b/include/clang/AST/ExprCXX.h
@@ -301,7 +301,8 @@ public:
/// \c static_cast<int>(1.0).
class CXXStaticCastExpr final
: public CXXNamedCastExpr,
- private llvm::TrailingObjects<CXXStaticCastExpr, CXXBaseSpecifier *> {
+ private llvm::TrailingObjects<CXXStaticCastExpr, CastExpr::BasePathSizeTy,
+ CXXBaseSpecifier *> {
CXXStaticCastExpr(QualType ty, ExprValueKind vk, CastKind kind, Expr *op,
unsigned pathSize, TypeSourceInfo *writtenTy,
SourceLocation l, SourceLocation RParenLoc,
@@ -312,6 +313,10 @@ class CXXStaticCastExpr final
explicit CXXStaticCastExpr(EmptyShell Empty, unsigned PathSize)
: CXXNamedCastExpr(CXXStaticCastExprClass, Empty, PathSize) {}
+ size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
+ return path_empty() ? 0 : 1;
+ }
+
public:
friend class CastExpr;
friend TrailingObjects;
@@ -337,7 +342,8 @@ public:
/// check to determine how to perform the type conversion.
class CXXDynamicCastExpr final
: public CXXNamedCastExpr,
- private llvm::TrailingObjects<CXXDynamicCastExpr, CXXBaseSpecifier *> {
+ private llvm::TrailingObjects<
+ CXXDynamicCastExpr, CastExpr::BasePathSizeTy, CXXBaseSpecifier *> {
CXXDynamicCastExpr(QualType ty, ExprValueKind VK, CastKind kind,
Expr *op, unsigned pathSize, TypeSourceInfo *writtenTy,
SourceLocation l, SourceLocation RParenLoc,
@@ -348,6 +354,10 @@ class CXXDynamicCastExpr final
explicit CXXDynamicCastExpr(EmptyShell Empty, unsigned pathSize)
: CXXNamedCastExpr(CXXDynamicCastExprClass, Empty, pathSize) {}
+ size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
+ return path_empty() ? 0 : 1;
+ }
+
public:
friend class CastExpr;
friend TrailingObjects;
@@ -380,6 +390,7 @@ public:
class CXXReinterpretCastExpr final
: public CXXNamedCastExpr,
private llvm::TrailingObjects<CXXReinterpretCastExpr,
+ CastExpr::BasePathSizeTy,
CXXBaseSpecifier *> {
CXXReinterpretCastExpr(QualType ty, ExprValueKind vk, CastKind kind,
Expr *op, unsigned pathSize,
@@ -392,6 +403,10 @@ class CXXReinterpretCastExpr final
CXXReinterpretCastExpr(EmptyShell Empty, unsigned pathSize)
: CXXNamedCastExpr(CXXReinterpretCastExprClass, Empty, pathSize) {}
+ size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
+ return path_empty() ? 0 : 1;
+ }
+
public:
friend class CastExpr;
friend TrailingObjects;
@@ -419,7 +434,8 @@ public:
/// value.
class CXXConstCastExpr final
: public CXXNamedCastExpr,
- private llvm::TrailingObjects<CXXConstCastExpr, CXXBaseSpecifier *> {
+ private llvm::TrailingObjects<CXXConstCastExpr, CastExpr::BasePathSizeTy,
+ CXXBaseSpecifier *> {
CXXConstCastExpr(QualType ty, ExprValueKind VK, Expr *op,
TypeSourceInfo *writtenTy, SourceLocation l,
SourceLocation RParenLoc, SourceRange AngleBrackets)
@@ -429,6 +445,10 @@ class CXXConstCastExpr final
explicit CXXConstCastExpr(EmptyShell Empty)
: CXXNamedCastExpr(CXXConstCastExprClass, Empty, 0) {}
+ size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
+ return path_empty() ? 0 : 1;
+ }
+
public:
friend class CastExpr;
friend TrailingObjects;
@@ -721,7 +741,7 @@ public:
}
};
-/// A member reference to an MSPropertyDecl.
+/// A member reference to an MSPropertyDecl.
///
/// This expression always has pseudo-object type, and therefore it is
/// typically not encountered in a fully-typechecked expression except
@@ -1471,7 +1491,8 @@ public:
/// \endcode
class CXXFunctionalCastExpr final
: public ExplicitCastExpr,
- private llvm::TrailingObjects<CXXFunctionalCastExpr, CXXBaseSpecifier *> {
+ private llvm::TrailingObjects<
+ CXXFunctionalCastExpr, CastExpr::BasePathSizeTy, CXXBaseSpecifier *> {
SourceLocation LParenLoc;
SourceLocation RParenLoc;
@@ -1486,6 +1507,10 @@ class CXXFunctionalCastExpr final
explicit CXXFunctionalCastExpr(EmptyShell Shell, unsigned PathSize)
: ExplicitCastExpr(CXXFunctionalCastExprClass, Shell, PathSize) {}
+ size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
+ return path_empty() ? 0 : 1;
+ }
+
public:
friend class CastExpr;
friend TrailingObjects;
@@ -1591,7 +1616,7 @@ class LambdaExpr final : public Expr,
/// The number of captures.
unsigned NumCaptures : 16;
-
+
/// The default capture kind, which is a value of type
/// LambdaCaptureDefault.
unsigned CaptureDefault : 2;
@@ -1602,10 +1627,10 @@ class LambdaExpr final : public Expr,
/// Whether this lambda had the result type explicitly specified.
unsigned ExplicitResultType : 1;
-
+
/// The location of the closing brace ('}') that completes
/// the lambda.
- ///
+ ///
/// The location of the brace is also available by looking up the
/// function call operator in the lambda class. However, it is
/// stored here to improve the performance of getSourceRange(), and
@@ -1673,7 +1698,7 @@ public:
/// Retrieve this lambda's captures.
capture_range captures() const;
-
+
/// Retrieve an iterator pointing to the first lambda capture.
capture_iterator capture_begin() const;
@@ -1686,7 +1711,7 @@ public:
/// Retrieve this lambda's explicit captures.
capture_range explicit_captures() const;
-
+
/// Retrieve an iterator pointing to the first explicit
/// lambda capture.
capture_iterator explicit_capture_begin() const;
@@ -1754,18 +1779,18 @@ public:
SourceRange getIntroducerRange() const { return IntroducerRange; }
/// Retrieve the class that corresponds to the lambda.
- ///
+ ///
/// This is the "closure type" (C++1y [expr.prim.lambda]), and stores the
/// captures in its fields and provides the various operations permitted
/// on a lambda (copying, calling).
CXXRecordDecl *getLambdaClass() const;
/// Retrieve the function call operator associated with this
- /// lambda expression.
+ /// lambda expression.
CXXMethodDecl *getCallOperator() const;
- /// If this is a generic lambda expression, retrieve the template
- /// parameter list associated with it, or else return null.
+ /// If this is a generic lambda expression, retrieve the template
+ /// parameter list associated with it, or else return null.
TemplateParameterList *getTemplateParameterList() const;
/// Whether this is a generic lambda.
@@ -1784,7 +1809,7 @@ public:
/// Whether this lambda had its result type explicitly specified.
bool hasExplicitResultType() const { return ExplicitResultType; }
-
+
static bool classof(const Stmt *T) {
return T->getStmtClass() == LambdaExprClass;
}
@@ -2129,7 +2154,7 @@ public:
Expr *getArgument() { return cast<Expr>(Argument); }
const Expr *getArgument() const { return cast<Expr>(Argument); }
- /// Retrieve the type being destroyed.
+ /// Retrieve the type being destroyed.
///
/// If the type being destroyed is a dependent type which may or may not
/// be a pointer, return an invalid type.
@@ -2345,13 +2370,13 @@ class TypeTraitExpr final
private llvm::TrailingObjects<TypeTraitExpr, TypeSourceInfo *> {
/// The location of the type trait keyword.
SourceLocation Loc;
-
+
/// The location of the closing parenthesis.
SourceLocation RParenLoc;
-
+
// Note: The TypeSourceInfos for the arguments are allocated after the
// TypeTraitExpr.
-
+
TypeTraitExpr(QualType T, SourceLocation Loc, TypeTrait Kind,
ArrayRef<TypeSourceInfo *> Args,
SourceLocation RParenLoc,
@@ -2377,26 +2402,26 @@ public:
static TypeTraitExpr *CreateDeserialized(const ASTContext &C,
unsigned NumArgs);
-
+
/// Determine which type trait this expression uses.
TypeTrait getTrait() const {
return static_cast<TypeTrait>(TypeTraitExprBits.Kind);
}
- bool getValue() const {
- assert(!isValueDependent());
- return TypeTraitExprBits.Value;
+ bool getValue() const {
+ assert(!isValueDependent());
+ return TypeTraitExprBits.Value;
}
-
+
/// Determine the number of arguments to this type trait.
unsigned getNumArgs() const { return TypeTraitExprBits.NumArgs; }
-
+
/// Retrieve the Ith argument.
TypeSourceInfo *getArg(unsigned I) const {
assert(I < getNumArgs() && "Argument out-of-range");
return getArgs()[I];
}
-
+
/// Retrieve the argument types.
ArrayRef<TypeSourceInfo *> getArgs() const {
return llvm::makeArrayRef(getTrailingObjects<TypeSourceInfo *>(),
@@ -2409,7 +2434,7 @@ public:
static bool classof(const Stmt *T) {
return T->getStmtClass() == TypeTraitExprClass;
}
-
+
// Iterators
child_range children() {
return child_range(child_iterator(), child_iterator());