[cfe-commits] r106903 - /cfe/trunk/lib/Sema/SemaExprCXX.cpp
Ted Kremenek
kremenek at apple.com
Fri Jun 25 15:48:49 PDT 2010
Author: kremenek
Date: Fri Jun 25 17:48:49 2010
New Revision: 106903
URL: http://llvm.org/viewvc/llvm-project?rev=106903&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=106903&r1=106902&r2=106903&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Jun 25 17:48:49 2010
@@ -671,7 +671,8 @@
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 @@
ParenTypeId,
AllocType,
D.getSourceRange().getBegin(),
- D.getSourceRange(),
+ R,
Owned(ArraySize),
ConstructorLParen,
move(ConstructorArgs),
@@ -851,13 +852,15 @@
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
More information about the cfe-commits
mailing list