diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2010-06-29 23:50:44 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2010-06-29 23:50:44 +0000 |
commit | f186b54cc68e13a819736a54bc11d37179029154 (patch) | |
tree | 895a432c727ba8406518f1fbed59b866c279697f | |
parent | acb0bd85d30ecacbe872ca9d9cfac5d7b6038a43 (diff) |
Retain the source location of the constructor when building an implicit member
initialization. I tried several ideas but couldn't come up with a test case for
this that didn't rely on a Clang bug to report a diagnostic after template
instantiation of the constructor due to the implicit initializers. Suggestions
welcome. This fixes the source location aspect of PR7402.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107226 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 63452f9cbc..29455087ae 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1580,8 +1580,9 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, if (Field->isInvalidDecl()) return true; + SourceLocation Loc = Constructor->getLocation(); + if (ImplicitInitKind == IIK_Copy) { - SourceLocation Loc = Constructor->getLocation(); ParmVarDecl *Param = Constructor->getParamDecl(0); QualType ParamType = Param->getType().getNonReferenceType(); @@ -1689,7 +1690,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, if (FieldBaseElementType->isRecordType()) { InitializedEntity InitEntity = InitializedEntity::InitializeMember(Field); InitializationKind InitKind = - InitializationKind::CreateDefault(Constructor->getLocation()); + InitializationKind::CreateDefault(Loc); InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, 0, 0); Sema::OwningExprResult MemberInit = @@ -1701,10 +1702,9 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, CXXMemberInit = new (SemaRef.Context) CXXBaseOrMemberInitializer(SemaRef.Context, - Field, SourceLocation(), - SourceLocation(), + Field, Loc, Loc, MemberInit.takeAs<Expr>(), - SourceLocation()); + Loc); return false; } |