[cfe-commits] r167507 - in /cfe/trunk: include/clang/AST/ExprCXX.h include/clang/Sema/Sema.h lib/AST/ExprCXX.cpp lib/Sema/SemaExprCXX.cpp lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp

David Blaikie dblaikie at gmail.com
Thu Nov 8 14:54:40 PST 2012


On Thu, Nov 8, 2012 at 1:50 PM, Abramo Bagnara
<abramo.bagnara at bugseng.com> wrote:
> Il 07/11/2012 01:12, David Blaikie ha scritto:
>> Author: dblaikie
>> Date: Tue Nov  6 18:12:38 2012
>> New Revision: 167507
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=167507&view=rev
>> Log:
>> PR13552: Fix the end location of a CXXNewExpr.
>>
>> Spent longer than reasonable looking for a nice way to test this & decided to
>> give up for now. Open to suggestions/requests. Richard Smith suggested adding
>> something to ASTMatchers but it wasn't readily apparent how to test this with
>> that.
>
> After this commit we have a regression: the range for "new MyClass()"
> now does not include the final parentheses.

Right you are.

>
>>
>> -SourceLocation CXXNewExpr::getEndLoc() const {
>> -  switch (getInitializationStyle()) {
>> -  case NoInit:
>> -    return AllocatedTypeInfo->getTypeLoc().getEndLoc();
>> -  case CallInit:
>> -    return DirectInitRange.getEnd();
>> -  case ListInit:
>> -    return getInitializer()->getSourceRange().getEnd();
>> -  }
>> -  llvm_unreachable("bogus initialization style");
>> -}
>
> I guess that the problem is due to removal of the code above without a
> proper replacement.

Indeed. Fixed in r167597.

Thanks,
- David



More information about the cfe-commits mailing list