diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-11-01 01:16:03 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-11-01 01:16:03 +0000 |
commit | 76852c218a207ef43583515cb835b6e855353a0f (patch) | |
tree | b055d2ceca0168d9a31f52bb3f34732abb6b49dc /lib/Sema/SemaDeclCXX.cpp | |
parent | d8c4551fa22a9c346e6a9e56333915197c97e394 (diff) |
Rework the AST for the initializer of a delegating constructor, so
that it retains source location information for the type. Aside from
general goodness (being able to walk the types described in that
information), we now have a proper representation for dependent
delegating constructors. Fixes PR10457 (for real).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143410 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 42d7b2f48f..c43db52132 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -2125,13 +2125,12 @@ Sema::BuildMemberInitializer(ValueDecl *Member, MemInitResult Sema::BuildDelegatingInitializer(TypeSourceInfo *TInfo, const MultiInitializer &Args, - SourceLocation NameLoc, CXXRecordDecl *ClassDecl) { - SourceLocation Loc = TInfo->getTypeLoc().getLocalSourceRange().getBegin(); + SourceLocation NameLoc = TInfo->getTypeLoc().getLocalSourceRange().getBegin(); if (!LangOpts.CPlusPlus0x) - return Diag(Loc, diag::err_delegating_ctor) + return Diag(NameLoc, diag::err_delegating_ctor) << TInfo->getTypeLoc().getLocalSourceRange(); - Diag(Loc, diag::warn_cxx98_compat_delegating_ctor); + Diag(NameLoc, diag::warn_cxx98_compat_delegating_ctor); // Initialize the object. InitializedEntity DelegationEntity = InitializedEntity::InitializeDelegation( @@ -2158,9 +2157,7 @@ Sema::BuildDelegatingInitializer(TypeSourceInfo *TInfo, if (DelegationInit.isInvalid()) return true; - assert(!CurContext->isDependentContext()); - return new (Context) CXXCtorInitializer(Context, Loc, Args.getStartLoc(), - Constructor, + return new (Context) CXXCtorInitializer(Context, TInfo, Args.getStartLoc(), DelegationInit.takeAs<Expr>(), Args.getEndLoc()); } @@ -2210,7 +2207,7 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, if (!Dependent) { if (Context.hasSameUnqualifiedType(QualType(ClassDecl->getTypeForDecl(),0), BaseType)) - return BuildDelegatingInitializer(BaseTInfo, Args, BaseLoc, ClassDecl); + return BuildDelegatingInitializer(BaseTInfo, Args, ClassDecl); FindBaseInitializer(*this, ClassDecl, BaseType, DirectBaseSpec, VirtualBaseSpec); @@ -3000,12 +2997,12 @@ DiagnoseBaseOrMemInitializerOrder(Sema &SemaRef, if (PrevInit->isAnyMemberInitializer()) D << 0 << PrevInit->getAnyMember()->getDeclName(); else - D << 1 << PrevInit->getBaseClassInfo()->getType(); + D << 1 << PrevInit->getTypeSourceInfo()->getType(); if (Init->isAnyMemberInitializer()) D << 0 << Init->getAnyMember()->getDeclName(); else - D << 1 << Init->getBaseClassInfo()->getType(); + D << 1 << Init->getTypeSourceInfo()->getType(); // Move back to the initializer's location in the ideal list. for (IdealIndex = 0; IdealIndex != NumIdealInits; ++IdealIndex) |