Store the SourceLocation of right parentheses in member initializers. Patch by Anders Johnsen!

llvm-svn: 80416
This commit is contained in:
Anders Carlsson 2009-08-29 01:31:33 +00:00
parent 6e1ca8315c
commit 1e172e068f
3 changed files with 15 additions and 8 deletions

View File

@ -841,18 +841,21 @@ class CXXBaseOrMemberInitializer {
/// IdLoc - Location of the id in ctor-initializer list.
SourceLocation IdLoc;
/// RParenLoc - Location of the right paren of the ctor-initializer.
SourceLocation RParenLoc;
public:
/// CXXBaseOrMemberInitializer - Creates a new base-class initializer.
explicit
CXXBaseOrMemberInitializer(QualType BaseType, Expr **Args, unsigned NumArgs,
CXXConstructorDecl *C,
SourceLocation L);
SourceLocation L, SourceLocation R);
/// CXXBaseOrMemberInitializer - Creates a new member initializer.
explicit
CXXBaseOrMemberInitializer(FieldDecl *Member, Expr **Args, unsigned NumArgs,
CXXConstructorDecl *C,
SourceLocation L);
SourceLocation L, SourceLocation R);
/// ~CXXBaseOrMemberInitializer - Destroy the base or member initializer.
~CXXBaseOrMemberInitializer();
@ -923,6 +926,7 @@ public:
const CXXConstructorDecl *getConstructor() const { return CtorToCall; }
SourceLocation getSourceLocation() const { return IdLoc; }
SourceLocation getRParenLoc() const { return RParenLoc; }
/// arg_begin() - Retrieve an iterator to the first initializer argument.
arg_iterator arg_begin() { return Args; }

View File

@ -400,8 +400,8 @@ QualType CXXMethodDecl::getThisType(ASTContext &C) const {
CXXBaseOrMemberInitializer::
CXXBaseOrMemberInitializer(QualType BaseType, Expr **Args, unsigned NumArgs,
CXXConstructorDecl *C,
SourceLocation L)
: Args(0), NumArgs(0), IdLoc(L) {
SourceLocation L, SourceLocation R)
: Args(0), NumArgs(0), IdLoc(L), RParenLoc(R) {
BaseOrMember = reinterpret_cast<uintptr_t>(BaseType.getTypePtr());
assert((BaseOrMember & 0x01) == 0 && "Invalid base class type pointer");
BaseOrMember |= 0x01;
@ -419,8 +419,8 @@ CXXBaseOrMemberInitializer(QualType BaseType, Expr **Args, unsigned NumArgs,
CXXBaseOrMemberInitializer::
CXXBaseOrMemberInitializer(FieldDecl *Member, Expr **Args, unsigned NumArgs,
CXXConstructorDecl *C,
SourceLocation L)
: Args(0), NumArgs(0), IdLoc(L) {
SourceLocation L, SourceLocation R)
: Args(0), NumArgs(0), IdLoc(L), RParenLoc(R) {
BaseOrMember = reinterpret_cast<uintptr_t>(Member);
assert((BaseOrMember & 0x01) == 0 && "Invalid member pointer");
@ -622,6 +622,7 @@ CXXConstructorDecl::setBaseOrMemberInitializers(
CXXBaseOrMemberInitializer *Member =
new (C) CXXBaseOrMemberInitializer(VBase->getType(), 0, 0,
VBaseDecl->getDefaultConstructor(C),
SourceLocation(),
SourceLocation());
AllToInit.push_back(Member);
}
@ -648,6 +649,7 @@ CXXConstructorDecl::setBaseOrMemberInitializers(
CXXBaseOrMemberInitializer *Member =
new (C) CXXBaseOrMemberInitializer(Base->getType(), 0, 0,
BaseDecl->getDefaultConstructor(C),
SourceLocation(),
SourceLocation());
AllToInit.push_back(Member);
}
@ -690,6 +692,7 @@ CXXConstructorDecl::setBaseOrMemberInitializers(
CXXBaseOrMemberInitializer *Member =
new (C) CXXBaseOrMemberInitializer((*Field), 0, 0,
Ctor,
SourceLocation(),
SourceLocation());
AllToInit.push_back(Member);
}

View File

@ -797,7 +797,7 @@ Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args,
}
// FIXME: Perform direct initialization of the member.
return new (Context) CXXBaseOrMemberInitializer(Member, (Expr **)Args,
NumArgs, C, IdLoc);
NumArgs, C, IdLoc, RParenLoc);
}
Sema::MemInitResult
@ -880,7 +880,7 @@ Sema::BuildBaseInitializer(QualType BaseType, Expr **Args,
}
return new (Context) CXXBaseOrMemberInitializer(BaseType, (Expr **)Args,
NumArgs, C, IdLoc);
NumArgs, C, IdLoc, RParenLoc);
}
void