Handle new by passing the Declaration to the Action, not a processed type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60413 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp
index c0f2985..1bf07c4 100644
--- a/lib/AST/ExprCXX.cpp
+++ b/lib/AST/ExprCXX.cpp
@@ -80,30 +80,32 @@
// CXXNewExpr
CXXNewExpr::CXXNewExpr(bool globalNew, FunctionDecl *operatorNew,
Expr **placementArgs, unsigned numPlaceArgs,
- bool parenTypeId, QualType alloc,
+ bool parenTypeId, Expr *arraySize,
CXXConstructorDecl *constructor, bool initializer,
Expr **constructorArgs, unsigned numConsArgs,
FunctionDecl *operatorDelete, QualType ty,
SourceLocation startLoc, SourceLocation endLoc)
: Expr(CXXNewExprClass, ty), GlobalNew(globalNew), ParenTypeId(parenTypeId),
- Initializer(initializer), NumPlacementArgs(numPlaceArgs),
+ Initializer(initializer), Array(arraySize), NumPlacementArgs(numPlaceArgs),
NumConstructorArgs(numConsArgs), OperatorNew(operatorNew),
- OperatorDelete(operatorDelete), Constructor(constructor), AllocType(alloc),
+ OperatorDelete(operatorDelete), Constructor(constructor),
StartLoc(startLoc), EndLoc(endLoc)
{
- unsigned TotalSize = NumPlacementArgs + NumConstructorArgs;
+ unsigned TotalSize = Array + NumPlacementArgs + NumConstructorArgs;
SubExprs = new Stmt*[TotalSize];
unsigned i = 0;
- for(unsigned j = 0; j < NumPlacementArgs; ++j)
+ if (Array)
+ SubExprs[i++] = arraySize;
+ for (unsigned j = 0; j < NumPlacementArgs; ++j)
SubExprs[i++] = placementArgs[j];
- for(unsigned j = 0; j < NumConstructorArgs; ++j)
+ for (unsigned j = 0; j < NumConstructorArgs; ++j)
SubExprs[i++] = constructorArgs[j];
assert(i == TotalSize);
}
Stmt::child_iterator CXXNewExpr::child_begin() { return &SubExprs[0]; }
Stmt::child_iterator CXXNewExpr::child_end() {
- return &SubExprs[0] + getNumPlacementArgs() + getNumConstructorArgs();
+ return &SubExprs[0] + Array + getNumPlacementArgs() + getNumConstructorArgs();
}
// CXXDeleteExpr