startLoc = E->getLocStart();
startLoc = SM->getInstantiationLoc(startLoc);
endBuf = SM->getCharacterData(startLoc);
- if (dyn_cast<CXXConstructExpr>(E)) {
- // Hack alter!
- // SemaInit sets startLoc to beginning of the initialized variable when
- // rhs involvs copy construction initialization. Must compensate for this.
- if (char *atEqual = strchr(endBuf, '='))
- endBuf = atEqual + 1;
- }
-
ByrefType += " " + Name;
ByrefType += " = {(void*)";
ByrefType += utostr(isa);
// Build a call to the selected constructor.
ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(S);
- SourceLocation Loc = Kind.getLocation();
+ SourceLocation Loc = Kind.isCopyInit() ? Kind.getEqualLoc()
+ : Kind.getLocation();
// Determine the arguments required to actually perform the constructor
// call.
// An explicitly-constructed temporary, e.g., X(1, 2).
unsigned NumExprs = ConstructorArgs.size();
Expr **Exprs = (Expr **)ConstructorArgs.take();
- S.MarkDeclarationReferenced(Kind.getLocation(), Constructor);
+ S.MarkDeclarationReferenced(Loc, Constructor);
CurInit = S.Owned(new (S.Context) CXXTemporaryObjectExpr(S.Context,
Constructor,
Entity.getType(),
- Kind.getLocation(),
+ Loc,
Exprs,
NumExprs,
Kind.getParenRange().getEnd(),
return Locations[1];
}
+ bool isCopyInit() const { return Kind == SIK_Copy; }
+
/// \brief Retrieve the source range containing the locations of the open
/// and closing parentheses for value and direct initializations.
SourceRange getParenRange() const {