summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclTemplate.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-06-22 09:54:51 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-06-22 09:54:51 +0000
commitcb6f346873334d638550651b172e29ec71a3ce35 (patch)
treeed8ca5b39056f1474621b196bf28942ea7a2c9a4 /clang/lib/AST/DeclTemplate.cpp
parent1e63c74f60812364cd13d90f1b285487fc96d311 (diff)
downloadbcm5719-llvm-cb6f346873334d638550651b172e29ec71a3ce35.tar.gz
bcm5719-llvm-cb6f346873334d638550651b172e29ec71a3ce35.zip
Make it easier to read/write the template part of FunctionDecl.
Introduce: -FunctionDecl::getTemplatedKind() which returns an enum signifying what kind of templated FunctionDecl it is. -An overload of FunctionDecl::setFunctionTemplateSpecialization() which accepts arrays of TemplateArguments and TemplateArgumentLocs -A constructor to TemplateArgumentList which accepts an array of TemplateArguments. llvm-svn: 106532
Diffstat (limited to 'clang/lib/AST/DeclTemplate.cpp')
-rw-r--r--clang/lib/AST/DeclTemplate.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index a318de656f2..3ac32bc80b7 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -391,6 +391,22 @@ TemplateArgumentList::TemplateArgumentList(ASTContext &Context,
}
}
+TemplateArgumentList::TemplateArgumentList(ASTContext &Context,
+ unsigned NumArgs,
+ const TemplateArgument *Args)
+ : NumFlatArguments(NumArgs),
+ NumStructuredArguments(NumArgs) {
+
+ TemplateArgument *NewArgs = new (Context) TemplateArgument[NumArgs];
+ std::copy(Args, Args+NumArgs, NewArgs);
+ FlatArguments.setPointer(NewArgs);
+ FlatArguments.setInt(1); // Owns the pointer.
+
+ // Just reuse the flat arguments array.
+ StructuredArguments.setPointer(NewArgs);
+ StructuredArguments.setInt(0); // Doesn't own the pointer.
+}
+
/// Produces a shallow copy of the given template argument list. This
/// assumes that the input argument list outlives it. This takes the list as
/// a pointer to avoid looking like a copy constructor, since this really
OpenPOWER on IntegriCloud