Improve source location information for C++ member initializers in a
constructor, by keeping the DeclaratorInfo* rather than just the type
and a single location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90355 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 8808bf7..95725bf 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1620,14 +1620,19 @@
MemInitResult NewInit;
if (Init->isBaseInitializer()) {
- QualType BaseType(Init->getBaseClass(), 0);
- BaseType = SubstType(BaseType, TemplateArgs, Init->getSourceLocation(),
- New->getDeclName());
-
- NewInit = BuildBaseInitializer(BaseType,
+ DeclaratorInfo *BaseDInfo = SubstType(Init->getBaseClassInfo(),
+ TemplateArgs,
+ Init->getSourceLocation(),
+ New->getDeclName());
+ if (!BaseDInfo) {
+ New->setInvalidDecl();
+ continue;
+ }
+
+ NewInit = BuildBaseInitializer(BaseDInfo->getType(), BaseDInfo,
(Expr **)NewArgs.data(),
NewArgs.size(),
- Init->getSourceLocation(),
+ Init->getLParenLoc(),
Init->getRParenLoc(),
New->getParent());
} else if (Init->isMemberInitializer()) {
@@ -1643,6 +1648,7 @@
NewInit = BuildMemberInitializer(Member, (Expr **)NewArgs.data(),
NewArgs.size(),
Init->getSourceLocation(),
+ Init->getLParenLoc(),
Init->getRParenLoc());
}