diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-01-09 00:59:40 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-01-09 00:59:40 +0000 |
| commit | b5d1a73988b80ca57b5702a10baff1b20d9d4cbc (patch) | |
| tree | 30a1e90c37a4127cddccc66f275b35e166e8c591 /clang/lib | |
| parent | 94a9ae776d940fe05985c9a984d1a40534eebdeb (diff) | |
| download | bcm5719-llvm-b5d1a73988b80ca57b5702a10baff1b20d9d4cbc.tar.gz bcm5719-llvm-b5d1a73988b80ca57b5702a10baff1b20d9d4cbc.zip | |
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, ...).
llvm-svn: 225489
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaType.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 6a910c2fc45..0f96a1cbce3 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/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. |

