diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-01-12 22:41:29 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-01-12 22:41:29 +0000 |
commit | 1d5d0b9df6d2a3df338bc3e63000536406e7666c (patch) | |
tree | 7986c81096111348632c4f5df0cecaae315322c8 /lib/AST/ExprCXX.cpp | |
parent | 9370c8f4af43a98a6f16e65f5d88d58db846e374 (diff) |
Add the location of the right parenthesis of a C++ named cast
(static_cast, dynamic_cast, reinterpret_cast, or const_cast) to
improve source-location information. Fixes PR8960.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123336 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprCXX.cpp')
-rw-r--r-- | lib/AST/ExprCXX.cpp | 23 |
1 files changed, 15 insertions, 8 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) { |