summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-26 22:09:24 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-26 22:09:24 +0000
commit408c619afc8afc1e5c76a6c89fec0f838bd66e84 (patch)
treeabce6de6a5f4db35d395561523a838fdedee0c96 /clang/lib
parentec3cbfe8c6ea07c53c8d34abefd6b422afe9fc49 (diff)
downloadbcm5719-llvm-408c619afc8afc1e5c76a6c89fec0f838bd66e84.tar.gz
bcm5719-llvm-408c619afc8afc1e5c76a6c89fec0f838bd66e84.zip
Template instantiation for "typeof" for both types and expressions.
llvm-svn: 72440
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiate.cpp17
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateExpr.cpp8
2 files changed, 18 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 3c32a21073d..86e69997bcc 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -414,17 +414,22 @@ TemplateTypeInstantiator::InstantiateTypedefType(const TypedefType *T,
QualType
TemplateTypeInstantiator::InstantiateTypeOfExprType(const TypeOfExprType *T,
unsigned Quals) const {
- // FIXME: Implement this
- assert(false && "Cannot instantiate TypeOfExprType yet");
- return QualType();
+ Sema::OwningExprResult E
+ = SemaRef.InstantiateExpr(T->getUnderlyingExpr(), TemplateArgs);
+ if (E.isInvalid())
+ return QualType();
+
+ return SemaRef.Context.getTypeOfExprType(E.takeAs<Expr>());
}
QualType
TemplateTypeInstantiator::InstantiateTypeOfType(const TypeOfType *T,
unsigned Quals) const {
- // FIXME: Implement this
- assert(false && "Cannot instantiate TypeOfType yet");
- return QualType();
+ QualType Underlying = Instantiate(T->getUnderlyingType());
+ if (Underlying.isNull())
+ return QualType();
+
+ return SemaRef.Context.getTypeOfType(Underlying);
}
QualType
diff --git a/clang/lib/Sema/SemaTemplateInstantiateExpr.cpp b/clang/lib/Sema/SemaTemplateInstantiateExpr.cpp
index 0c298393308..9dc14d551ba 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateExpr.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateExpr.cpp
@@ -138,9 +138,15 @@ TemplateExprInstantiator::VisitDeclRefExpr(DeclRefExpr *E) {
else
assert(false &&
"FIXME: instantiation of non-local variable declarations");
- } else if (isa<FunctionDecl>(D) || isa<OverloadedFunctionDecl>(D)) {
+ } else if (isa<FunctionDecl>(D)) {
// FIXME: Instantiate decl!
NewD = cast<ValueDecl>(D);
+ } else if (isa<OverloadedFunctionDecl>(D)) {
+ // FIXME: instantiate decls?
+ return SemaRef.Owned(new (SemaRef.Context) DeclRefExpr(cast<NamedDecl>(D),
+ SemaRef.Context.OverloadTy,
+ E->getLocation(),
+ false, false));
} else
assert(false && "FIXME: unhandled declaration reference kind");
OpenPOWER on IntegriCloud