diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-06-27 10:35:30 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-06-27 10:35:30 +0000 |
commit | 2d10542533756f8346b0d925f4af29e7d065c572 (patch) | |
tree | 11f5aaba37641fdb52d488e7c99275d785d54cbd /lib/Sema/SemaDeclCXX.cpp | |
parent | 8be210b0a28c079aa07ffdb46d8e274bc9e4be70 (diff) |
Recommit r306103: PR26195: Set correct NestedNameSpecifierLoc for the
dependent initializer
This commit fixes incorrect source positions of dependent c'tor initializers
like in the following code:
template<typename MyBase>
struct Derived: MyBase::InnerIterator
{
Derived() : MyBase::InnerIterator() {} /// This line is problematic: all positions point to InnerIterator and nothing points to MyBase
};
Patch by Serge Preis!
Differential Revision: https://reviews.llvm.org/D32439
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306392 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 453ece9d9c..e9070881af 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -3778,6 +3778,15 @@ Sema::BuildMemInitializer(Decl *ConstructorD, if (BaseType.isNull()) return true; + TInfo = Context.CreateTypeSourceInfo(BaseType); + DependentNameTypeLoc TL = + TInfo->getTypeLoc().castAs<DependentNameTypeLoc>(); + if (!TL.isNull()) { + TL.setNameLoc(IdLoc); + TL.setElaboratedKeywordLoc(SourceLocation()); + TL.setQualifierLoc(SS.getWithLocInContext(Context)); + } + R.clear(); R.setLookupName(MemberOrBase); } |