//===--- SemaTemplateInstantiateExpr.cpp - C++ Template Expr Instantiation ===/
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//===----------------------------------------------------------------------===/
//
// This file implements C++ template instantiation for expressions.
//
//===----------------------------------------------------------------------===/
#include "Sema.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/Parse/DeclSpec.h"
#include "clang/Parse/Designator.h"
#include "clang/Lex/Preprocessor.h" // for the identifier table
#include "llvm/Support/Compiler.h"
using namespace clang;
namespace {
class VISIBILITY_HIDDEN TemplateExprInstantiator
: public StmtVisitor<TemplateExprInstantiator, Sema::OwningExprResult> {
Sema &SemaRef;
const TemplateArgumentList &TemplateArgs;
public:
typedef Sema::OwningExprResult OwningExprResult;
TemplateExprInstantiator(Sema &SemaRef,
const TemplateArgumentList &TemplateArgs)
: SemaRef(SemaRef), TemplateArgs(TemplateArgs) { }
// Declare VisitXXXStmt nodes for all of the expression kinds.
#define EXPR(Type, Base) OwningExprResult Visit##Type(Type *S);
#define STMT(Type, Base)
#include "clang/AST/StmtNodes.def"
// Base case. We can't get here.
Sema::OwningExprResult VisitStmt(Stmt *S) {
S->dump();
assert(false && "Cannot instantiate this kind of expression");
return SemaRef.ExprError();
}
};
}
// Base case. We can't get here.
Sema::OwningExprResult TemplateExprInstantiator::VisitExpr(Expr *E) {
E->dump();
assert(false && "Cannot instantiate this kind of expression");
return SemaRef.ExprError();
}
Sema::OwningExprResult
TemplateExprInstantiator::VisitPredefinedExpr(PredefinedExpr *E) {
return SemaRef.Owned(E->Retain());
}
Sema::OwningExprResult
TemplateExprInstantiator::VisitIntegerLiteral(IntegerLiteral *E) {
return SemaRef.Owned(E->Retain());
}
Sema::OwningExprResult
TemplateExprInstantiator::VisitFloatingLiteral(FloatingLiteral *E) {
return SemaRef.Owned(E->Retain());
}
Sema::