]> granicus.if.org Git - clang/commit
When performing template-substitution into a type, don't just replace the
authorJohn McCall <rjmccall@apple.com>
Sun, 18 Oct 2009 09:09:24 +0000 (09:09 +0000)
committerJohn McCall <rjmccall@apple.com>
Sun, 18 Oct 2009 09:09:24 +0000 (09:09 +0000)
commit49a832bd499d6f61c23655f1fac99f0dd229756e
treeddf407322f3e10a390fe7a1331cfb44b4ac3b0c0
parent6800b334e5390452c6f921dbb832dfbfce371359
When performing template-substitution into a type, don't just replace the
TemplateTypeParmType with the substituted type directly;  instead, replace it
with a SubstTemplateTypeParmType which will note that the type was originally
written as a template type parameter.  This makes it reasonable to preserve
source information even through template substitution.

Also define the new SubstTemplateTypeParmType class, obviously.

For consistency with current behavior, we stringize these types as if they
were the underlying type.  I'm not sure this is the right thing to do.
At any rate, I paled at adding yet another clause to the don't-desugar 'if'
statement, so I extracted a function to do it.  The new function also does
The Right Thing more often, I think:  e.g. if we have a chain of typedefs
leading to a vector type, we will now desugar all but the last one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84412 91177308-0d34-0410-b5e6-96231b3b80d8
12 files changed:
include/clang/AST/ASTContext.h
include/clang/AST/Type.h
include/clang/AST/TypeLoc.h
include/clang/AST/TypeNodes.def
include/clang/Frontend/PCHBitCodes.h
lib/AST/ASTContext.cpp
lib/AST/Type.cpp
lib/Frontend/PCHReader.cpp
lib/Frontend/PCHWriter.cpp
lib/Sema/Sema.cpp
lib/Sema/SemaTemplateInstantiate.cpp
lib/Sema/TreeTransform.h