aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-06-25 22:48:49 +0000
committerTed Kremenek <kremenek@apple.com>2010-06-25 22:48:49 +0000
commitf9d5bac60bce072a754ca629d3899e8c6c0b5018 (patch)
treef8d16cb29c41c32dbbf45326cb3d8d406abf5b10 /lib
parente347e776e7c1cae73ac0c40d63023a1f2bae2114 (diff)
Use TypeSourceInfo to help determine the SourceRange of a CXXNewExpr. This fixes several
cases where we generated an invalid SourceRange for this expression. Thanks to John McCall for helping me figure this out. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106903 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaExprCXX.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 3220494cbc..4d93e72be2 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -671,7 +671,8 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
QualType AllocType = TInfo->getType();
if (D.isInvalidType())
return ExprError();
-
+
+ SourceRange R = TInfo->getTypeLoc().getSourceRange();
return BuildCXXNew(StartLoc, UseGlobal,
PlacementLParen,
move(PlacementArgs),
@@ -679,7 +680,7 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
ParenTypeId,
AllocType,
D.getSourceRange().getBegin(),
- D.getSourceRange(),
+ R,
Owned(ArraySize),
ConstructorLParen,
move(ConstructorArgs),
@@ -851,13 +852,15 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
PlacementArgs.release();
ConstructorArgs.release();
ArraySizeE.release();
+
+ // FIXME: The TypeSourceInfo should also be included in CXXNewExpr.
return Owned(new (Context) CXXNewExpr(Context, UseGlobal, OperatorNew,
PlaceArgs, NumPlaceArgs, ParenTypeId,
ArraySize, Constructor, Init,
ConsArgs, NumConsArgs, OperatorDelete,
ResultType, StartLoc,
Init ? ConstructorRParen :
- SourceLocation()));
+ TypeRange.getEnd()));
}
/// CheckAllocatedType - Checks that a type is suitable as the allocated type