summaryrefslogtreecommitdiffstats
path: root/lib/Sema
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-01-09 00:59:40 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-01-09 00:59:40 +0000
commit3f15abb9bb51e8f9184b934f71d5779ab0ff48ef (patch)
tree8fca130c2e65cb9ab0e397a81a031bd87943f7f9 /lib/Sema
parenta1712b44df90b7bc23856a48d567bd34a1d43302 (diff)
Don't invent a '$auto-x-y' name for auto types in generic lambdas. This is no
better than the 'template-parameter-x-y' name that we'd get in AST printing, and is worse in several ways (it's harder to distinguish it from a user-supplied name, it's wrong after substituting some number of outer levels, it wastes time and space constructing an IdentifierInfo, ...). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225489 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaType.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 6a910c2fc4..0f96a1cbce 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1007,16 +1007,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
const unsigned TemplateParameterDepth = LSI->AutoTemplateParameterDepth;
const unsigned AutoParameterPosition = LSI->AutoTemplateParams.size();
const bool IsParameterPack = declarator.hasEllipsis();
-
- // Create a name for the invented template parameter type.
- std::string InventedTemplateParamName = "$auto-";
- llvm::raw_string_ostream ss(InventedTemplateParamName);
- ss << TemplateParameterDepth;
- ss << "-" << AutoParameterPosition;
- ss.flush();
-
- IdentifierInfo& TemplateParamII = Context.Idents.get(
- InventedTemplateParamName.c_str());
+
// Turns out we must create the TemplateTypeParmDecl here to
// retrieve the corresponding template parameter type.
TemplateTypeParmDecl *CorrespondingTemplateParam =
@@ -1031,7 +1022,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
/*NameLoc*/ declarator.getLocStart(),
TemplateParameterDepth,
AutoParameterPosition, // our template param index
- /* Identifier*/ &TemplateParamII, false, IsParameterPack);
+ /* Identifier*/ nullptr, false, IsParameterPack);
LSI->AutoTemplateParams.push_back(CorrespondingTemplateParam);
// Replace the 'auto' in the function parameter with this invented
// template type parameter.