diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/ExprCXX.cpp | 23 | ||||
-rw-r--r-- | lib/Sema/SemaCXXCast.cpp | 9 | ||||
-rw-r--r-- | lib/Serialization/ASTReaderStmt.cpp | 4 | ||||
-rw-r--r-- | lib/Serialization/ASTWriterStmt.cpp | 3 |
4 files changed, 25 insertions, 14 deletions
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index fcedb8e7bb..0426e59a74 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -525,12 +525,14 @@ CXXStaticCastExpr *CXXStaticCastExpr::Create(ASTContext &C, QualType T, CastKind K, Expr *Op, const CXXCastPath *BasePath, TypeSourceInfo *WrittenTy, - SourceLocation L) { + SourceLocation L, + SourceLocation RParenLoc) { unsigned PathSize = (BasePath ? BasePath->size() : 0); void *Buffer = C.Allocate(sizeof(CXXStaticCastExpr) + PathSize * sizeof(CXXBaseSpecifier*)); CXXStaticCastExpr *E = - new (Buffer) CXXStaticCastExpr(T, VK, K, Op, PathSize, WrittenTy, L); + new (Buffer) CXXStaticCastExpr(T, VK, K, Op, PathSize, WrittenTy, L, + RParenLoc); if (PathSize) E->setCastPath(*BasePath); return E; } @@ -547,12 +549,14 @@ CXXDynamicCastExpr *CXXDynamicCastExpr::Create(ASTContext &C, QualType T, CastKind K, Expr *Op, const CXXCastPath *BasePath, TypeSourceInfo *WrittenTy, - SourceLocation L) { + SourceLocation L, + SourceLocation RParenLoc) { unsigned PathSize = (BasePath ? BasePath->size() : 0); void *Buffer = C.Allocate(sizeof(CXXDynamicCastExpr) + PathSize * sizeof(CXXBaseSpecifier*)); CXXDynamicCastExpr *E = - new (Buffer) CXXDynamicCastExpr(T, VK, K, Op, PathSize, WrittenTy, L); + new (Buffer) CXXDynamicCastExpr(T, VK, K, Op, PathSize, WrittenTy, L, + RParenLoc); if (PathSize) E->setCastPath(*BasePath); return E; } @@ -568,12 +572,14 @@ CXXReinterpretCastExpr * CXXReinterpretCastExpr::Create(ASTContext &C, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *BasePath, - TypeSourceInfo *WrittenTy, SourceLocation L) { + TypeSourceInfo *WrittenTy, SourceLocation L, + SourceLocation RParenLoc) { unsigned PathSize = (BasePath ? BasePath->size() : 0); void *Buffer = C.Allocate(sizeof(CXXReinterpretCastExpr) + PathSize * sizeof(CXXBaseSpecifier*)); CXXReinterpretCastExpr *E = - new (Buffer) CXXReinterpretCastExpr(T, VK, K, Op, PathSize, WrittenTy, L); + new (Buffer) CXXReinterpretCastExpr(T, VK, K, Op, PathSize, WrittenTy, L, + RParenLoc); if (PathSize) E->setCastPath(*BasePath); return E; } @@ -588,8 +594,9 @@ CXXReinterpretCastExpr::CreateEmpty(ASTContext &C, unsigned PathSize) { CXXConstCastExpr *CXXConstCastExpr::Create(ASTContext &C, QualType T, ExprValueKind VK, Expr *Op, TypeSourceInfo *WrittenTy, - SourceLocation L) { - return new (C) CXXConstCastExpr(T, VK, Op, WrittenTy, L); + SourceLocation L, + SourceLocation RParenLoc) { + return new (C) CXXConstCastExpr(T, VK, Op, WrittenTy, L, RParenLoc); } CXXConstCastExpr *CXXConstCastExpr::CreateEmpty(ASTContext &C) { diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index 37eeac139b..ba1c3b0f40 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/lib/Sema/SemaCXXCast.cpp @@ -172,7 +172,8 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, CheckConstCast(*this, Ex, DestType, VK, OpRange, DestRange); return Owned(CXXConstCastExpr::Create(Context, DestType.getNonLValueExprType(Context), - VK, Ex, DestTInfo, OpLoc)); + VK, Ex, DestTInfo, OpLoc, + Parens.getEnd())); case tok::kw_dynamic_cast: { CastKind Kind = CK_Dependent; @@ -183,7 +184,7 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, return Owned(CXXDynamicCastExpr::Create(Context, DestType.getNonLValueExprType(Context), VK, Kind, Ex, &BasePath, DestTInfo, - OpLoc)); + OpLoc, Parens.getEnd())); } case tok::kw_reinterpret_cast: { CastKind Kind = CK_Dependent; @@ -192,7 +193,7 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, return Owned(CXXReinterpretCastExpr::Create(Context, DestType.getNonLValueExprType(Context), VK, Kind, Ex, 0, - DestTInfo, OpLoc)); + DestTInfo, OpLoc, Parens.getEnd())); } case tok::kw_static_cast: { CastKind Kind = CK_Dependent; @@ -203,7 +204,7 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, return Owned(CXXStaticCastExpr::Create(Context, DestType.getNonLValueExprType(Context), VK, Kind, Ex, &BasePath, - DestTInfo, OpLoc)); + DestTInfo, OpLoc, Parens.getEnd())); } } diff --git a/lib/Serialization/ASTReaderStmt.cpp b/lib/Serialization/ASTReaderStmt.cpp index 5ed6f8e4d5..b0a1e4e475 100644 --- a/lib/Serialization/ASTReaderStmt.cpp +++ b/lib/Serialization/ASTReaderStmt.cpp @@ -1006,7 +1006,9 @@ void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) { void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) { VisitExplicitCastExpr(E); - E->setOperatorLoc(ReadSourceLocation(Record, Idx)); + SourceRange R = ReadSourceRange(Record, Idx); + E->Loc = R.getBegin(); + E->RParenLoc = R.getEnd(); } void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) { diff --git a/lib/Serialization/ASTWriterStmt.cpp b/lib/Serialization/ASTWriterStmt.cpp index af066bb425..c41cc1a751 100644 --- a/lib/Serialization/ASTWriterStmt.cpp +++ b/lib/Serialization/ASTWriterStmt.cpp @@ -984,7 +984,8 @@ void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) { void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) { VisitExplicitCastExpr(E); - Writer.AddSourceLocation(E->getOperatorLoc(), Record); + Writer.AddSourceRange(SourceRange(E->getOperatorLoc(), E->getRParenLoc()), + Record); } void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) { |