[cfe-commits] r123332 - in /cfe/trunk: lib/CodeGen/CGExprScalar.cpp test/CodeGenCXX/variadic-templates.cpp
Douglas Gregor
dgregor at apple.com
Wed Jan 12 14:11:34 PST 2011
Author: dgregor
Date: Wed Jan 12 16:11:34 2011
New Revision: 123332
URL: http://llvm.org/viewvc/llvm-project?rev=123332&view=rev
Log:
Add IR generation support for SizeOfPackExpr.
Added:
cfe/trunk/test/CodeGenCXX/variadic-templates.cpp
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=123332&r1=123331&r2=123332&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Jan 12 16:11:34 2011
@@ -195,6 +195,11 @@
return Builder.CreateBitCast(V, ConvertType(E->getType()));
}
+ Value *VisitSizeOfPackExpr(SizeOfPackExpr *E) {
+ return llvm::ConstantInt::get(ConvertType(E->getType()),
+ E->getPackLength());
+ }
+
// l-values.
Value *VisitDeclRefExpr(DeclRefExpr *E) {
Expr::EvalResult Result;
Added: cfe/trunk/test/CodeGenCXX/variadic-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/variadic-templates.cpp?rev=123332&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/variadic-templates.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/variadic-templates.cpp Wed Jan 12 16:11:34 2011
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+
+template<typename ...Types>
+int get_num_types(Types...) {
+ return sizeof...(Types);
+}
+
+// CHECK: define weak_odr i32 @_Z13get_num_typesIJifdEEispT_
+// CHECK: ret i32 3
+template int get_num_types(int, float, double);
+
+
More information about the cfe-commits
mailing list