aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-09 16:33:13 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-09 16:33:13 +0000
commita1a04786cea2445759026edacd096abd1fbf4a05 (patch)
tree947186f59f5612280a44351e6025d664540facb1 /lib/Sema/SemaTemplateInstantiateDecl.cpp
parentb2ebdf9ced01a9d691b64952a747289d28fc089e (diff)
Eliminate the comma locations from all of the Sema routines that deal
with comma-separated lists. We never actually used the comma locations, nor did we store them in the AST, but we did manage to waste time during template instantiation to produce fake locations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113495 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp22
1 files changed, 5 insertions, 17 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 1c7869fecd..b8690f6eb2 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -251,7 +251,6 @@ Decl *TemplateDeclInstantiator::VisitTypedefDecl(TypedefDecl *D) {
static bool InstantiateInitializationArguments(Sema &SemaRef,
Expr **Args, unsigned NumArgs,
const MultiLevelTemplateArgumentList &TemplateArgs,
- llvm::SmallVectorImpl<SourceLocation> &FakeCommaLocs,
ASTOwningVector<Expr*> &InitArgs) {
for (unsigned I = 0; I != NumArgs; ++I) {
// When we hit the first defaulted argument, break out of the loop:
@@ -263,12 +262,7 @@ static bool InstantiateInitializationArguments(Sema &SemaRef,
if (Arg.isInvalid())
return true;
- Expr *ArgExpr = (Expr *)Arg.get();
InitArgs.push_back(Arg.release());
-
- // FIXME: We're faking all of the comma locations. Do we need them?
- FakeCommaLocs.push_back(
- SemaRef.PP.getLocForEndOfToken(ArgExpr->getLocEnd()));
}
return false;
@@ -290,7 +284,6 @@ static bool InstantiateInitializationArguments(Sema &SemaRef,
static bool InstantiateInitializer(Sema &S, Expr *Init,
const MultiLevelTemplateArgumentList &TemplateArgs,
SourceLocation &LParenLoc,
- llvm::SmallVector<SourceLocation, 4> &CommaLocs,
ASTOwningVector<Expr*> &NewArgs,
SourceLocation &RParenLoc) {
NewArgs.clear();
@@ -314,8 +307,7 @@ static bool InstantiateInitializer(Sema &S, Expr *Init,
RParenLoc = ParenList->getRParenLoc();
return InstantiateInitializationArguments(S, ParenList->getExprs(),
ParenList->getNumExprs(),
- TemplateArgs, CommaLocs,
- NewArgs);
+ TemplateArgs, NewArgs);
}
if (CXXConstructExpr *Construct = dyn_cast<CXXConstructExpr>(Init)) {
@@ -323,13 +315,12 @@ static bool InstantiateInitializer(Sema &S, Expr *Init,
if (InstantiateInitializationArguments(S,
Construct->getArgs(),
Construct->getNumArgs(),
- TemplateArgs,
- CommaLocs, NewArgs))
+ TemplateArgs, NewArgs))
return true;
// FIXME: Fake locations!
LParenLoc = S.PP.getLocForEndOfToken(Init->getLocStart());
- RParenLoc = CommaLocs.empty()? LParenLoc : CommaLocs.back();
+ RParenLoc = LParenLoc;
return false;
}
}
@@ -419,17 +410,15 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
// Instantiate the initializer.
SourceLocation LParenLoc, RParenLoc;
- llvm::SmallVector<SourceLocation, 4> CommaLocs;
ASTOwningVector<Expr*> InitArgs(SemaRef);
if (!InstantiateInitializer(SemaRef, D->getInit(), TemplateArgs, LParenLoc,
- CommaLocs, InitArgs, RParenLoc)) {
+ InitArgs, RParenLoc)) {
// Attach the initializer to the declaration.
if (D->hasCXXDirectInitializer()) {
// Add the direct initializer to the declaration.
SemaRef.AddCXXDirectInitializerToDecl(Var,
LParenLoc,
move_arg(InitArgs),
- CommaLocs.data(),
RParenLoc);
} else if (InitArgs.size() == 1) {
Expr *Init = InitArgs.take()[0];
@@ -2281,11 +2270,10 @@ Sema::InstantiateMemInitializers(CXXConstructorDecl *New,
SourceLocation LParenLoc, RParenLoc;
ASTOwningVector<Expr*> NewArgs(*this);
- llvm::SmallVector<SourceLocation, 4> CommaLocs;
// Instantiate the initializer.
if (InstantiateInitializer(*this, Init->getInit(), TemplateArgs,
- LParenLoc, CommaLocs, NewArgs, RParenLoc)) {
+ LParenLoc, NewArgs, RParenLoc)) {
AnyErrors = true;
continue;
}