summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/TreeTransform.h
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-30 18:55:50 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-30 18:55:50 +0000
commit14cf752486f3589d110b4dfd7ff985d44d18da3a (patch)
tree777b70579325d2c8ffcfeb0286ea11b180ee91c9 /clang/lib/Sema/TreeTransform.h
parentbe474734a534299fe3c5745ca4fe13598d9eb7c7 (diff)
downloadbcm5719-llvm-14cf752486f3589d110b4dfd7ff985d44d18da3a.tar.gz
bcm5719-llvm-14cf752486f3589d110b4dfd7ff985d44d18da3a.zip
Clean up our handling of local instantiation scopes, which keep track
of the mapping from local declarations to their instantiated counterparts during template instantiation. Previously, we tried to do some unholy merging of local instantiation scopes that involved storing a single hash table along with an "undo" list on the side... which was ugly, and never handled function parameters properly. Now, we just keep separate hash tables for each local instantiation scope, and "combining" two scopes means that we'll look in each of the combined hash tables. The combined scope stack is rarely deep, and this makes it easy to avoid the "undo" issues we were hitting. Also, I've simplified the logic for function parameters: if we're declaring a function and we need the function parameters to live longer, we just push them back into the local instantiation scope where we need them. Fixes PR6990. llvm-svn: 102732
Diffstat (limited to 'clang/lib/Sema/TreeTransform.h')
-rw-r--r--clang/lib/Sema/TreeTransform.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 5143b77f592..445cf17aadf 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -2907,17 +2907,19 @@ QualType
TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB,
FunctionProtoTypeLoc TL,
QualType ObjectType) {
- FunctionProtoType *T = TL.getTypePtr();
- QualType ResultType = getDerived().TransformType(TLB, TL.getResultLoc());
- if (ResultType.isNull())
- return QualType();
-
- // Transform the parameters.
+ // Transform the parameters. We do this first for the benefit of template
+ // instantiations, so that the ParmVarDecls get/ placed into the template
+ // instantiation scope before we transform the function type.
llvm::SmallVector<QualType, 4> ParamTypes;
llvm::SmallVector<ParmVarDecl*, 4> ParamDecls;
if (getDerived().TransformFunctionTypeParams(TL, ParamTypes, ParamDecls))
return QualType();
-
+
+ FunctionProtoType *T = TL.getTypePtr();
+ QualType ResultType = getDerived().TransformType(TLB, TL.getResultLoc());
+ if (ResultType.isNull())
+ return QualType();
+
QualType Result = TL.getType();
if (getDerived().AlwaysRebuild() ||
ResultType != T->getResultType() ||
OpenPOWER on IntegriCloud