summaryrefslogtreecommitdiffstats
path: root/include/clang/AST/Expr.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/AST/Expr.h')
-rw-r--r--include/clang/AST/Expr.h39
1 files changed, 26 insertions, 13 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index cfbae9f..2527817 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -1462,14 +1462,19 @@ class CompoundLiteralExpr : public Expr {
/// compound literal like "(int){4}". This can be null if this is a
/// synthesized compound expression.
SourceLocation LParenLoc;
+
+ /// The type as written. This can be an incomplete array type, in
+ /// which case the actual expression type will be different.
+ TypeSourceInfo *TInfo;
Stmt *Init;
bool FileScope;
public:
// FIXME: Can compound literals be value-dependent?
- CompoundLiteralExpr(SourceLocation lparenloc, QualType ty, Expr *init,
- bool fileScope)
- : Expr(CompoundLiteralExprClass, ty, ty->isDependentType(), false),
- LParenLoc(lparenloc), Init(init), FileScope(fileScope) {}
+ CompoundLiteralExpr(SourceLocation lparenloc, TypeSourceInfo *tinfo,
+ QualType T, Expr *init, bool fileScope)
+ : Expr(CompoundLiteralExprClass, T,
+ tinfo->getType()->isDependentType(), false),
+ LParenLoc(lparenloc), TInfo(tinfo), Init(init), FileScope(fileScope) {}
/// \brief Construct an empty compound literal.
explicit CompoundLiteralExpr(EmptyShell Empty)
@@ -1485,6 +1490,9 @@ public:
SourceLocation getLParenLoc() const { return LParenLoc; }
void setLParenLoc(SourceLocation L) { LParenLoc = L; }
+ TypeSourceInfo *getTypeSourceInfo() const { return TInfo; }
+ void setTypeSourceInfo(TypeSourceInfo* tinfo) { TInfo = tinfo; }
+
virtual SourceRange getSourceRange() const {
// FIXME: Init should never be null.
if (!Init)
@@ -1712,24 +1720,28 @@ public:
/// expression will be an lvalue. The reference type, however, will
/// not be used as the type of the expression.
class ExplicitCastExpr : public CastExpr {
- /// TypeAsWritten - The type that this expression is casting to, as
- /// written in the source code.
- QualType TypeAsWritten;
+ /// TInfo - Source type info for the (written) type
+ /// this expression is casting to.
+ TypeSourceInfo *TInfo;
protected:
ExplicitCastExpr(StmtClass SC, QualType exprTy, CastKind kind,
- Expr *op, QualType writtenTy)
- : CastExpr(SC, exprTy, kind, op), TypeAsWritten(writtenTy) {}
+ Expr *op, TypeSourceInfo *writtenTy)
+ : CastExpr(SC, exprTy, kind, op), TInfo(writtenTy) {}
/// \brief Construct an empty explicit cast.
ExplicitCastExpr(StmtClass SC, EmptyShell Shell)
: CastExpr(SC, Shell) { }
public:
+ /// getTypeInfoAsWritten - Returns the type source info for the type
+ /// that this expression is casting to.
+ TypeSourceInfo *getTypeInfoAsWritten() const { return TInfo; }
+ void setTypeInfoAsWritten(TypeSourceInfo *writtenTy) { TInfo = writtenTy; }
+
/// getTypeAsWritten - Returns the type that this expression is
/// casting to, as written in the source code.
- QualType getTypeAsWritten() const { return TypeAsWritten; }
- void setTypeAsWritten(QualType T) { TypeAsWritten = T; }
+ QualType getTypeAsWritten() const { return TInfo->getType(); }
static bool classof(const Stmt *T) {
StmtClass SC = T->getStmtClass();
@@ -1750,8 +1762,9 @@ class CStyleCastExpr : public ExplicitCastExpr {
SourceLocation LPLoc; // the location of the left paren
SourceLocation RPLoc; // the location of the right paren
public:
- CStyleCastExpr(QualType exprTy, CastKind kind, Expr *op, QualType writtenTy,
- SourceLocation l, SourceLocation r) :
+ CStyleCastExpr(QualType exprTy, CastKind kind, Expr *op,
+ TypeSourceInfo *writtenTy,
+ SourceLocation l, SourceLocation r) :
ExplicitCastExpr(CStyleCastExprClass, exprTy, kind, op, writtenTy),
LPLoc(l), RPLoc(r) {}
OpenPOWER on IntegriCloud